Runtime model validation for partially-observable hybrid systems
11204838 · 2021-12-21
Assignee
Inventors
Cpc classification
G05B23/0245
PHYSICS
G06F11/3006
PHYSICS
G05B23/0286
PHYSICS
G06F30/3323
PHYSICS
G06F11/3604
PHYSICS
International classification
G06F11/14
PHYSICS
G06F11/34
PHYSICS
Abstract
Disclosed herein are techniques to make the synthesized monitoring conditions of partially-observable hybrid systems robust to partial observability of sensor uncertainty and partial controllability due to actuator disturbance. The approach herein shows that the monitoring conditions result in provable safety guarantees with fallback controllers that react to monitor violation at runtime.
Claims
1. A process for verifying compliance of a partially observable cyber-physical system (CPS) with a proven hybrid model of the CPS, the hybrid model describing a desired behavior of the CPS with both observable and unobservable variables, comprising the steps of: deriving a monitor specification from the hybrid model in differential dynamic logic, the monitor specification comprising a set of logical constraints regarding behavior of the model; obtaining consecutive sensor measurements from one or more sensors measuring one or more observable quantities during operation of the CPS; determining a monitor verdict, using the monitor specification, the monitor verdict indicating success if prior measurements of the one or more observable quantities are predictive of future measurements of the one or more observable quantities and one or more inferred unobservable quantities within an acceptable measurement uncertainty, and, indicating failure otherwise; wherein a successful monitor verdict guarantees safety of the CPS and compliance of the observable and unobservable true behavior of the CPS with the hybrid model; and engaging a fallback action of the CPS when the monitor verdict indicates failure.
2. The process of claim 1 wherein the CPS includes a controller running control software, the controller reading the one or more sensors and controlling one or more actuators, wherein the hybrid model specifies the actions of the controller, the sensors, the actuators and the resulting changes in state of the CPS to verify the desired behavior of the CPS.
3. The process of claim 1, wherein the hybrid model describes discrete control actions of one or more controllers in the CPS and continuous physics of the CPS and the environment of the CPS.
4. The process of claim 2 wherein discrepancies between the one or more sensor measurements and unobservable true values is due, at least in part, to disturbances in the one or more actuators.
5. The process of claim 4 wherein actuator disturbances may be determined by monitoring differences between an intended effect of an actuator action and an actual effect of the actuator action from observable quantities.
6. The process of claim 2 wherein discrepancies between the one or more sensor measurements and unobservable true values are reflected as sensor uncertainties.
7. The process of claim 1 further comprising: proving, offline, that the hybrid model ensures that all potential true values for the one or more variables satisfy an invariant property of the hybrid model; and monitoring, online, that some potential true values of the one or more variables can be connected with the hybrid model.
8. The process of claim 1 further comprising: identifying non-compliance of the CPS with the monitor specification when two consecutive measurements for any variable show significant deviation from the monitor specification.
9. The process of claim 1 further comprising: determining acceptable bounds for future true values of the one or more variables based on an aggregate of actuation and measurement history for the one or more variables; and updating the bounds each time second measurements are received; and determining gradual deviation of the true values of the one or more variables from the hybrid model over multiple measurements.
10. The process of claim 1 wherein no controller violation that can be overwritten when the monitor fails can cause unsafety of the hybrid model.
11. The process of claim 1 wherein a monitor violation will be triggered when any deviation between measurements and the hybrid model permits unsafe future model behavior.
12. The process of claim 2 further comprising executing the hybrid model in conjunction with the control software to guarantee compliance of the CPS with the hybrid model.
13. The process of claim 2 wherein the step of transforming the hybrid model and monitor specification into a set of monitor conditions further comprises applying a theorem prover to the hybrid model and monitor specification.
14. The process of claim 2 where the hybrid model consists of a model monitor, a controller monitor and a prediction monitor.
15. The process of claim 14 wherein the model monitor compares a current state of the CPS with a previous state of the CPS and determines if the difference between the current state and the previous state is in compliance with the hybrid model.
16. The process of claim 14 wherein the controller monitor monitors the controller to check compliance with the hybrid model.
17. The process of claim 14 wherein the prediction monitor allows deviations of the CPS system from the hybrid model to account for real-world imperfections.
18. The process of claim 17 wherein the model monitor, the controller monitor and the prediction monitor read the one or more sensors to determine a current state of the CPS.
19. The process of claim 14 wherein the model monitor runs prior to the control software and determines if observed physical behavior which occurred between the previous state of the CPS and the current state of the CPS is in compliance with the hybrid model.
20. The process of claim 19 wherein the model monitor will raise an error if the difference between the current state and the previous state is not in compliance with the hybrid model.
21. The process of claim 19 wherein the controller monitor runs after the controller software and determines if physical actions to be taken by the controller will result in the CPS being in compliance with the hybrid model.
22. The process of claim 21 wherein the controller monitor raises an error if the physical actions to be taken by the controller will result in the CPS not being in compliance with the hybrid model.
23. The process of claim 14 wherein the prediction monitor runs after the control software and determines if physical actions to be taken by the controller will result in the CPS being in compliance with the hybrid model in the presence of bounded deviations between the CPS and the hybrid model.
24. The process of claim 23 wherein the prediction monitor will raise an error if the physical actions to be taken by the controller will result in the CPS not being in compliance with the hybrid model.
25. The process of claim 24 wherein the hybrid model comprises a set of formulas of the form:
ϕ.fwdarw.[α*]ψ with invariat φ.fwdarw.[α]φs.t.ϕ.fwdarw.φ and φ.fwdarw.ψ (1)
26. The process of claim 1 wherein the monitor specification comprises a set of specification conjectures for model monitors of the form:
Ø|.sub.const.fwdarw.a
γ.sub.V.sub.
27. The process of claim 1 wherein the monitor specification comprises a set of specification conjectures for controller monitors of the form:
Ø|.sub.const.fwdarw.a.sub.ctrl
γ.sub.V.sub.
28. The process of claim 1 wherein the process is automated if the hybrid model is of the form (α.sub.ctrl; α.sub.plant) without nested loops, with solvable differential equations in α.sub.plant and a disturbed plant α.sub.δplant with constant additive disturbance δ.
29. The process of claim 14 wherein compliance with the model monitor guarantees that the properties of the hybrid model are present in the CPS before the controller software is executed.
30. The process of claim 14, the compliance with the controller monitor guaranteeing that properties of the hybrid model are present in the CPS after the controller software is executed.
31. The process of claim 14, wherein compliance with the prediction monitor guarantees that properties of the hybrid model will still be present in future states of the CPS.
Description
DETAILED DESCRIPTION
(1) Preliminaries: Differential Dynamic Logic
(2) For hybrid systems verification differential dynamic logic d is used, which has a notation for hybrid systems as hybrid programs. d
allows us to make statements that we want to be true for all runs of a hybrid program ([α]Ø) or for at least one run (<α>Ø) of a hybrid program.
(3) Both constructs are necessary to derive safe monitors: [α]Ø proofs are needed to ensure that all behavior of a model (including controllers) is safe; <α>Ø proofs are needed to find monitor specifications that detect whether or not system execution fits to the verified model.
(4) Table 1 summarizes the relevant syntax fragment of hybrid programs together with an informal semantics. The semantics ρ(α) of hybrid program α is a relation on initial and final states of running α. The set of d formulas is generated by the following grammar (<∈{<, ≤, =, ≥, >} and θ.sub.1, θ.sub.2 are arithmetic expressions in +, −, .Math.,/over the reals):
ϕ::=θ.sub.1˜θ.sub.2|¬ϕ|ϕ∧ψ|ϕ∨ψ|ϕ.fwdarw.ψ|∀xϕ|∃xϕ|[α]ϕ|<α>ϕ
(5) Differential dynamic logic comes uses a theorem prover with a verification technique to prove correctness properties of hybrid programs. One example of a theorem prover and the one that is used in the preferred embodiment of the invention is KeYmaera.
(6) TABLE-US-00001 TABLE 1 Hybrid program representations of hybrid systems. Statement Effect α; β sequential composition, first run hybrid program α, then hybrid program β α ∪ β nondeterministic choice, following either hybrid program α or β α* nondeterministic repetition, repeats hybrid program α n ≥ 0 times x := θ assign value of term θ to variable x (discrete jump) x := * assign arbitrary real number to variable x ?F check that a particular condition F holds, and abort if it does not (x.sub.i′ = θ.sub.i, . . . , evolve x.sub.i along differential equation system x.sub.i′ = θ.sub.i x.sub.n′ = θ.sub.n & F′) restricted to maximum evolution domain F′
ModelPlex Approach for Verified Runtime Validation
(7) CPS are almost impossible to get right without sufficient attention to prior analysis, for instance by formal verification and formal validation techniques. We assume to be given a verified model of a CPS, i.e. formula (1) is proved valid. Note that differential dynamic logic (d) and KeYmaera as a theorem prover are used to illustrate the concepts herein. The concept of ModelPlex is not predicated on the use of KeYmaera to prove (1). Other verification techniques could be used to establish validity of this formula. The flexibility of the underlying logic d
, its support for both [α]ϕ and <α>ϕ, and its proof calculus, however, are exploited for systematically constructing monitors from proofs in the sequel.
ϕ.fwdarw.[α*]ψ with invariat φ.fwdarw.[α]φs.t.ϕ.fwdarw.φ and φ.fwdarw.ψ (1)
(8) Eq.(1) expresses that all runs of the hybrid system α*, which start in states that satisfy the precondition Ø and repeat the model α arbitrarily many times, must end in states that satisfy the post condition ψ. Eq.(1) is proved using some form of induction, which shows that a loop invariant φ holds after every run of α if it was true before. The model α is a hybrid system model 100 of a CPS, which means that it describes both the discrete control actions of the controllers in the system and the continuous physics of the plant and the system's environment.
(9) The safety guarantees obtained by proving Eq.(1) about the model α* transfer to the real system, if the actual CPS execution fits to α*. Because safety properties should be preserved, a CPS γ fits to a model α*, if the CPS reaches at most those states that are reachable by the model, i.e., ρ(γ).Math.ρ(α*). However, we do not know γ and therefore need to find a condition based on α* that can be checked at runtime to see if concrete runs of γ behave like α*.
(10) Checking the post condition ψ is not sufficient because, if ψ does not hold, the system is already unsafe. Checking the invariant φ is insufficient as well, because if φ does not hold, the controller can no longer guarantee safety, even though the system may not yet be unsafe. But if we detect when a CPS is about to deviate from α* before leaving φ, we can still switch to a fail-safe controller to avoid ¬ψ from happening.
(11) As shown in
(12) Model Monitor 20—
(13) In each state ν.sub.i the sample point ν.sub.i−1 from the previous execution γ.sub.i−1 is tested for deviation from the single α, not α* i. e., test (ν.sub.i−1, ν.sub.i)∈ρ(α). If violated, other verified properties may no longer hold for the system. The system, however, is still safe if a prediction monitor 24 was satisfied on ν.sub.i−1. Frequent violations indicate an inadequate model that should be revised to better reflect reality.
(14) Controller Monitor 22—
(15) In intermediate state {tilde over (v)}.sub.i the current controller decisions of the implementation γ.sub.ctrl are tested for compliance with the model, i.e., test (v.sub.i, {tilde over (v)}.sub.i)∈ρ(α.sub.ctrl). Controller monitors 22 are designed for switching between controllers similar to Simplex. If violated, the commands from a fail-safe controller replace the current controller's decisions to ensure that no unsafe commands are ever actuated.
(16) Prediction Monitor 24—
(17) In intermediate state {tilde over (v)}.sub.i the worst-case safety impact of the current controller decisions are tested with respect to the predictions of a bounded deviation plant model α.sub.δplant, which has a tolerance around the model plant α.sub.plant, i.e., check ν.sub.i+1 □=φ for all ν.sub.i+1 such that ({tilde over (v)}.sub.i, ν.sub.i+1)∈ρ(α.sub.δplant). Note, that all ν.sub.i+1 are simultaneously checked by checking {tilde over (v)}.sub.i for a characterizing condition of α.sub.δplant. If violated, the current control choice is not guaranteed to keep the system safe until the next control cycle and, thus, a fail-safe controller takes over.
(18) The assumption for the prediction monitor 24 is that the real execution is not arbitrarily far off the plant models used for safety verification, because otherwise guarantees can neither be made on unobservable intermediate states nor on safety of the future system evolution. A separation of disturbance causes in the models can be used: ideal plant models α.sub.plant for correctness verification purposes, implementation deviation plant models α.sub.δplant for monitoring purposes. Any deviation model (e.g., piecewise constant disturbance, differential inclusion models of disturbance) is supported, as long as the deviation is bounded and differential invariants can be found. It is assumed that monitor evaluations are at most some e time units apart (e.g., along with a recurring controller execution). Note that disturbance in α.sub.δplant is more manageable compared to α*, as single runs α can be focused on instead of repetitions for monitoring.
(19) Relation Between States
(20) A check that inspects states of the actual CPS to detect deviation from the model α* is systematically derived. First, a notion of state recall is established and shows that, when all previous state pairs comply with the model, compliance of the entire execution can be checked by checking the latest two states (ν.sub.i−1, ν.sub.i).
(21) Definition 1 (State Recall).
(22) V is used to denote the set of variables whose state we want to recall. γ.sub.V.sup.−=∧.sub.x∈v.sup.x=x− are used to express a characterization of the values of variables in a state prior to a run of α, where the fresh variables x.sup.− to are always presumed to occur solely in γ.sub.V.sup.−. The variables in x.sup.− can be used to recall this state. Likewise, γ.sub.V.sup.+=∧.sub.x∈v.sup.x=x+ is used to characterize the posterior states and expect fresh x.sup.+.
(23) With this notation, the following lemma states that an interconnected sequence of α transitions forms a transition of α*.
(24) Lemma 1 (Loop Prior and Posterior State).
(25) Let α be a hybrid program and α* be the program that repeats arbitrarily many times. Assume that all consecutive pairs of states (ν.sub.i−1, ν.sub.i)∈ρ(α) of n∈.sup.+ executions, whose valuations are recalled with γ.sub.V.sup.i=∧.sub.x∈Vx=x.sup.i and γ.sub.V.sup.i-1 are plausible with respect to the model α, i.e.,
∧.sub.1≤i≤n (γ.sub.V.sup.i-1.fwdarw.
α
γ.sub.V.sup.i) with γ.sub.V.sup.−=γ.sub.V.sup.0 and γ.sub.V.sup.+=γ.sub.V.sup.n. Then, the sequence of states originates from an α* execution from γ.sub.V.sup.0 to γ.sub.V.sup.n, i.e.,
γ.sub.V.sup.−.fwdarw.
α*
γ.sub.V.sup.+.
(26) Lemma 1 enables us to check compliance with the model α* up to the current state by checking reachability of a posterior state from a prior state on each execution of α (i.e., online monitoring, which is easier because the loop was eliminated). To find compliance checks systematically, we construct formula (2), which relates a prior state of a CPS to its posterior state through at least one path through the model α. Consecutive states for α* mean before and after executions of α (i.e., α.sub.;.sup.↓α.sub.;.sup.↓α, not within α).
γ.sub.V.sup.−.fwdarw.<α>γ.sub.V.sup.+ (2)
(27) Eq.(2) is satisfied in a state v, if there is at least one run of the model α starting in the state v recalled by γ.sub.V.sup.− and which results in a state ω recalled using γ.sub.V.sup.+. In other words, at least one path through α explains how the prior state v got transformed into the posterior state ω. The d Eq.(2) characterizes the state transition relation of the model α directly. Its violation indicates compliance violation. Compliance at all intermediate states cannot be observed by real-world sensors.
(28) In principle, Eq.(2) would be a monitor, because it relates a prior state to a posterior state through the model of a CPS, but the formula is difficult, if not impossible, to evaluate at runtime, because it refers to a hybrid system α, which includes non-determinism and differential equations. The basic observation is that any equation that is equivalent to Eq.(2) but conceptually easier to evaluate in a state would be a correct monitor 112. We use theorem proving for simplifying Eq.(2) into quantifier-free first-order real arithmetic form so that it can be evaluated efficiently at runtime. The resulting first-order real arithmetic formula can be easily implemented in a runtime monitor and executed along with the actual controller. A monitor 112 is executable code that only returns true if the transition from the prior system state to the posterior state is compliant with the model 100. Thus, deviations from the model 100 can be detected at runtime, so that appropriate fallback and mitigation strategies can be initiated.
(29) The complexity for evaluating an arithmetic formula over the reals for concrete numbers is linear in the formula size, as opposed to deciding the validity of such formulas, which is doubly exponential. Evaluating the same formula on floating point numbers is inexpensive but may yield wrong results due to rounding errors; on exact rationals, the bit-complexity can be non-negligible. Interval arithmetic is used to obtain reliable results efficiently.
(30) ModelPlex Monitor Synthesis
(31) This section introduces the nature of ModelPlex monitor specifications, the approach in this invention for generating such specifications from hybrid system models, and how to turn those specifications into monitor code that can be executed at runtime along with the controller.
(32) A ModelPlex specification 104 corresponds to the d formula (2). If the current state of a system does not satisfy a ModelPlex specification 104, some behavior that is not reflected in the model 100 occurred (e.g., the wrong control action was taken, unanticipated dynamics in the environment occurred, sensor uncertainty led to unexpected values, or the system was applied outside the specified operating environment).
(33) A model monitor X.sub.m checks that two consecutive states v and w can be explained by an execution of the model α, i.e., (v, w)∈ρ(α). In the sequel, BV(α) are bound variables in α, FV(φ) are free variables in φ, Σ is the set of all variables, and A\B denotes the set of variables being in some set A but not in some other set B. Furthermore, we use v□□ to denote v projected onto the variables in A.
(34) Theorem 1 (Model Monitor Correctness).
(35) Let α* be provably safe, so ϕ.fwdarw.[α*]ψ. Let V.sub.m=BV (α)∪FV (ψ). Let v.sub.0, v.sub.1, v.sub.2 v.sub.3 . . . ∈
.sup.n be a sequence of states, with v.sub.0
ϕ and that agree on Σ\V.sub.m, i.e., v.sub.0|.sub.Σ\V.sub.
x.sub.m as x.sub.m evaluated in the state resulting from v by interpreting x.sup.+ as v.sub.i+1(x) for all x∈V.sub.m, i.e., v.sub.x.sub.
x.sub.m. If (v.sub.i, v.sub.i+1)
x.sub.m for all i<n then we have v.sub.n
ψ where
X.sub.m≡(ϕ|.sub.const.fwdarw.α
γ.sub.v.sub.
and ϕ|.sub.const denotes the conditions of ϕ that involve only constants that do not change in α, i. e., FV (ϕ|.sub.const)∩BV (α)=Ø.
(36) The approach shown herein to generate monitor specifications from hybrid system models 102 takes a verified d formula (1) as input 100 and produces a monitor x.sub.m in quantifier-free first-order form as output. The algorithm involves the following steps:
(37) A d formula (1) about a model α of the form ϕ.fwdarw.[α*]ψ is turned into a specification conjecture (3) of the form ϕ|.sub.const.fwdarw.
α
γ.sub.V.sub.
(38) Theorem proving on the specification conjecture (3) is applied until no further proof rules are applicable and only first-order real arithmetic formulas remain open. See process 106, resulting in monitor conditions 108, containing only first-order logic (FOL) in
(39) The monitor specification x.sub.m is the conjunction of the unprovable first-order real arithmetic formulas from open sub-goals.
(40) Generate the Monitor Conjecture.
(41) d formula (1) is mapped syntactically to a specification conjecture of the form (3). By design, this conjecture will not be provable. But the unprovable branches of a proof attempt will reveal information that, had it been in the premises, would make (3) provable. Through γ.sub.V.sub.
(42) Use Theorem Proving to Analyze the Specification Conjecture.
(43) The proof rules of d are used to analyze the specification conjecture x.sub.m. These proof rules syntactically decompose a hybrid model 100 into easier-to-handle parts, which leads to sequents with first-order real arithmetic formulas towards the leaves of a proof. Using real arithmetic quantifier elimination we close sequents with logical tautologies, which do not need to be checked at runtime since they always evaluate to true for any input. The conjunction of the remaining open sequents is the monitor specification 104, which implies (2).
(44) A complete sequence of proof rules applied to the monitor conjecture of the water tank is described in below. Most steps are simple when analyzing specification conjectures: sequential composition (;
), nondeterministic choice (
∪
), deterministic assignment (
:=
) and logical connectives (∧r etc.) replace current facts with simpler ones or branch the proof. Challenges arise from handling nondeterministic assignment and differential equations in hybrid programs.
(45) First, consider nondeterministic assignment x:=*. The proof rule for nondeterministic assignment (*
) results in a new existentially quantified variable. By sequent proof rule ∃r, this existentially quantified variable is instantiated with an arbitrary term θ, which is often a new logical variable that is implicitly existentially quantified. Weakening (Wr) removes facts that are no longer necessary.
(46)
(47) Optimization 1 (Instantiation Trigger).
(48) If the variable is not changed in the remaining α, x.sub.i=x.sub.i.sup.+ is γ.sub.V.sub.
(49) Otherwise, a new logical variable is introduced which may result in an existential quantifier in the monitor specification if no further constraints can be found later in the proof.
(50) Next, differential equations are handled. Even when the differential equation can be solved, existentially and universally quantified variables remain. Inspect the corresponding proof rule from the d calculus. For differential equations it must be proven that there exists a duration t, such that the differential equation stays within the evolution domain H throughout all intermediate times {tilde over (t)} and the result satisfies φ at the end. At this point there are three options: i. Option 1: instantiate the existential quantifier, if it is known that the duration will be t.sup.+; ii. Option 2: introduce a new logical variable, which is the generic case that always yields correct results, but may discover monitor specifications that are harder to evaluate; iii. Option 3: use quantifier elimination (QE) to obtain an equivalent quantifier-free result (a possible optimization could inspect the size of the resulting formula).
(51) The analysis of the specification conjecture finishes with collecting the open sequents from the proof to create the monitor specification x.sub.m∧ (open sequent) 104. The collected open sequents may include new logical variables and new (Skolem) function symbols that were introduced for nondeterministic assignments and differential equations when handling existential or universal quantifiers. The invertible quantifier rule i∃ is used to re-introduce existential quantifiers for the new logical variables. Often, the now quantified logical variables are discovered to be equal to one of the post-state variables later in the proof, because those variables did not change in the model after the assignment. If this is the case, proof rule ∃σ can be used to further simplify the monitor specification by substituting the corresponding logical variable x with its equal term θ.
(52)
Controller Monitor Synthesis
(53) A controller monitor x.sub.c, shown as reference number 112 in α.sub.ctrl
γ.sub.V.sub.
(54) Theorem 2 (Controller Monitor Correctness).
(55) Let α of the canonical form α.sub.ctrl; α.sub.plant. Assume ϕ.fwdarw.[α*]φ has been proven with invariant φ as in (1). Let v
φ|.sub.const∧φ, as checked by x.sub.m(Theorem 1). Furthermore, let {tilde over (v)} be a post-controller state. If (v, {tilde over (v)})
x.sub.c with x.sub.c≡ϕ|.sub.const.fwdarw.
α.sub.ctrl
γ.sub.V.sub.
φ.
(56) Monitoring in the Presence of Expected Uncertainty and Disturbance
(57) Up to now exact ideal-world models have been considered. However, real-world clocks drift, sensors measure with some uncertainty, and actuators are subject to disturbance. This makes the exact models safe but too conservative, which means that monitors for exact models are likely to fall back to a fail-safe controller unnecessarily often. This section is a discussion of how ModelPlex specifications are found such that the safety property (1) and the monitor specification become more robust to expected uncertainty and disturbance. That way, only unexpected deviations beyond those captured in the normal operational uncertainty and disturbance of α* cause the monitor to initiate fail-safe actions.
(58) In d we can, for example, use nondeterministic assignment from an interval to model sensor uncertainty and piecewise constant actuator disturbance, or differential inequalities for actuator disturbance. Such models include non-determinism about sensed values in the controller model and often need more complex physics models than differential equations with polynomial solutions.
(59) Currently, for finding model monitors, our prototype tool solves differential equations by the proof rule (′). Thus, it finds model monitor specifications for differential algebraic equations with polynomial solutions and for differential algebraic inequalities, which can be refined into solvable differential algebraic equations. For prediction monitors (discussed below) d techniques are used for finding differential variants and invariants, differential cuts, and differential auxiliaries to handle differential equations and inequalities without polynomial solutions.
(60) Monitoring Compliance Guarantees for Unobservable Intermediate States
(61) With controller monitors, non-compliance of a controller implementation with respect to the modeled controller can be detected right away. With model monitors, non-compliance of the actual system dynamics with respect to the modeled dynamics can be detected when they first occur. In such cases, a fail-safe action is switched to, which is verified using standard techniques, in both non-compliance cases. The crucial question is: can such a method always guarantee safety? The answer is linked to the image computation problem in model checking (i. e., approximation of states reachable from a current state), which is known to be not semi-decidable by numerical evaluation at points; approximation with uniform error is only possible if a bound is known for the continuous derivatives. This implies that additional assumptions are needed about the deviation between the actual and the modeled continuous dynamics to guarantee compliance for unobservable intermediate states. Unbounded deviation from the model between sample points just is unsafe, no matter how hard a controller tries. Hence, worst-case bounds capture how well reality is reflected in the model.
(62) A prediction monitor is derived to check whether a current control decision will be able to keep the system safe for time ε even if the actual continuous dynamics deviate from the model. A prediction monitor checks the current state, because all previous states are ensured by a model monitor and subsequent states are then safe by (1).
(63) Definition 2 (ε-Bounded Plant with Disturbance δ).
(64) Let α.sub.plant be a model of the form x′=θ & H. An ε-bounded plant with disturbance δ, written α.sub.δplant, is a plant model of the form x.sub.o:=0; (f(θ, δ)≤x′≤g(θ, δ)&H∧x.sub.o≤ε) for some f, g with fresh variable ε>0 and assuming x.sub.o′=1. That disturbance δ is constant if x.Math.δ; it is additive if f(θ, δ)=θ−δ and g(θ, δ)=θ+δ.
(65) Theorem 3 (Prediction Monitor Correctness).
(66) Let α* be provably safe, i. e., ϕ.fwdarw.[α*]ψ has been proved using invariant φ as in (1). Let V.sub.p=BV (α)∪FV ([α]φ]). Let v
ϕ|.sub.const∧φ, as checked by χ.sub.m from Theorem 1. Further assume {tilde over (v)} such that (v, {tilde over (v)})∈ρ(α.sub.ctrl), as checked by x from Theorem 2. If (v, {tilde over (v)})
χ.sub.p with χ.sub.p=(ϕ|.sub.const∧ϕ).fwdarw.
α.sub.ctrl
(γ.sub.V.sub.
φ.
(67) By adding a controller execution α.sub.ctrl
prior to the disturbed plant model, we synthesize prediction monitors that take the actual controller decisions into account. For safety purposes, a monitor definition without controller χ.sub.p≡(ϕ□.sub.const∧ϕ).fwdarw.[α.sub.δplant]φ could be used, but doing so results in a conservative monitor, which has to keep the CPS safe without knowledge of the actual controller decision.
(68) Decidability and Computability
(69) One useful characteristic of ModelPlex beyond soundness is that monitor synthesis is computable, which yields a synthesis algorithm, and that the correctness of those synthesized monitors with respect to their specification is decidable. See Theorem 4.
(70) Theorem 4 (Monitor Correctness is Decidable and Monitor Synthesis Computable).
(71) Assume canonical models of the form α≡α.sub.ctrl; α.sub.plant without nested loops, with solvable differential equations in α.sub.plant and disturbed plants α.sub.δplant with constant additive disturbance δ (see Definition. 2). Then, monitor correctness is decidable, i. e., the formulas χ.sub.m.fwdarw.α
γ.sub.V.sup.+, χ.sub.c.fwdarw.
α.sub.ctrl
γ.sub.V.sup.+γ.sub.V.sup.+, and χ.sub.p.fwdarw.
α.sub.ctrl
(γ.sub.V.sup.+∧[α.sub.δplant]φ) are decidable. Also, monitor synthesis is computable, i. e., the functions synth.sub.m:
α
γ.sub.V.sup.+
χ.sub.m, synth.sub.c:
α.sub.ctrl
γ.sub.V.sup.+
χ.sub.c, and synth.sub.p:
α.sub.ctrl
(γ.sub.V.sup.+∧[α.sub.δplant]φ)
χ.sub.p are computable.
(72) Monitor Synthesis and Fallback Controller Design—Design-by-Contract Monitoring
(73) Preconditions, postconditions and invariants are crucial conditions in CPS design. Monitors for these conditions can check (i) whether or not it is safe to start a particular controller (i. e., check that the precondition of a controller is satisfied), (ii) whether or not a controller complies with its specification (i. e., check that a controller delivers set values that satisfy its post condition), and (iii) whether or not the system is still within its safety bounds (i. e., check that the loop invariant of α* is satisfied).
(74) Precondition and post condition monitors are useful to decide whether or not it is safe to invoke a controller in the current state, and whether or not to trust a controller output. An invariant monitor of a CPS α* captures the main assumptions that have to be true throughout system execution. When an invariant monitor is unsatisfied, it may no longer be safe to run the CPS; a fail-safe controller can act as a mitigation strategy.
(75) Design-by-contract monitors are useful to monitor specific design decisions, which are explicitly marked in the model. Our approach systematically creates monitors for a complete specification of the behavior of the model.
(76) Monitor Synthesis
(77) Once we found a model monitor, controller monitor, or prediction monitor specification, we want to turn it into an actual monitor implementation (e. g., in C). The main challenge is to reliably transfer the monitor specification, which is evaluated on , into executable code that uses floating point representations. We use the interval arithmetic library Apron to represent each real arithmetic value with an interval of a pair of floating point numbers. The interval reliably contains the real.
(78) For certification purposes one still has to argue for the correctness of the actual machine code of the synthesized monitor. This entails that the transformation from the monitor specification as a first-order formula into actual code that evaluates the formula must be formally verified. If the synthesized code is still a high-level language, a certified compiler, can be used to produce machine code. Such a comprehensive proof chain suitable for certification is part of our ongoing research.
(79) Designing for a Fail-Safe Fallback Controller
(80) When we design a system for a fail-safe fallback controller ctrl.sub.safe, it is important to know within which bounds the fail-safe controller can still keep our CPS safe, and which design limits we want a controller implementation to obey. The invariant of a CPS with the fail-safe fallback controller describes the safety bounds. When we start the fail-safe fallback controller ctrl.sub.safe in a state where its invariant G is satisfied, it will guarantee to keep the CPS in a state that satisfies the safety property ψ.
(81) So, to safely operate an experimental controller ctrl.sub.exp, we want a monitor that informs us when the experimental controller can no longer guarantee the invariant of the fail-safe controller or when it is about to violate the design limits.
(82) A design for a CPS with a fail-safe fallback controller, therefore, involves proving two properties. First, we prove that the fail-safe controller ctrl.sub.safe ensures the safety property ψ as in Eq.(4) below. This property is only provable if we discover an invariant G for the CPS with the fail-safe controller. Then we use G as the safety condition for generating a prediction monitor.
Ø[(ctrl.sub.safe;plant)*@inv(G)]ψ (4)
(83) With this generic structure in mind, we can design for a fallback controller invoked by a model monitor X.sub.m, controller monitor X.sub.c, or prediction monitor X.sub.p. Upon violation of either X.sub.m, X.sub.c, or X.sub.p by the actual system execution, the set values of a fail-safe controller are used instead.
(84) Monitor Synthesis Algorithm
(85) Algorithm 1 lists the ModelPlex specification conjecture analysis algorithm 106, which turns a specification conjecture into an actual monitor, and is shown in flow-chart form in
(86) TABLE-US-00002 Algorithm 1: ModelPlex monitor synthesis input : A hybrid program α, a set of variables ν .Math. BV(α), an initial condition ϕ such that |= ϕ −> [α*]ψ, output: A monitor χ.sub.m such that |= χ.sub.m ≡ ϕ|.sub.const .fwdarw. <α>Y.sup.+, begin | S ← ∅ | Y.sup.+ ← Λ.sub.x∈ν x = x.sup.+ with fresh variables x.sub.i.sup.+ // Monitor conjecture | G ← {├ ϕ|.sub.const .fwdarw. <α>Y.sup.+} | while G ≠ ∅ do // Analyze monitor conjecture | | foreach g ∈ G do | | | G ← G − {g} | | | if g is first-order then | | | | if |≠ g then S ← S ∪ {g} | | | else | | | | {tilde over (g)} ← apply dL proof rule to g | | | | G ← G ∪ {{tilde over (g)}} | | | .sub.— | | .sub.— | .sub.— .sub.— χ.sub.m ← Λ.sub.s∈S s // Collect open sequents
Simulation
(87) To illustrate the behavior of the water tank model with a fallback controller, we created two monitors: Monitor X.sub.m validates the complete model (as in the examples throughout this work) and is executed at the beginning of each control cycle (before the controller runs). Monitor X.sub.c validates only the controller of the model α (compares prior and post state of
(88)
and is executed after the controller but before control actions are issued. Thus, monitor X, resembles conventional runtime verification approaches, which do not check CPS behavior for compliance with the complete hybrid model. This way, unexpected deviations from the model are detected at the beginning of each control cycle, while unsafe control actions are detected immediately before they are taken. With only monitor X.sub.m in place an additional control cycle would be required to detect unsafe control action, whereas with only monitor X.sub.c in place, deviations from the model would be missed. Note that the monitor X.sub.m could be run in place of X.sub.c to achieve the same effect. But monitor X.sub.m implements a more complicated formula, which is unnecessary when only the controller output should be validated.
(89)
(90)
for the first three controller cycles, which is unsafe on the third controller cycle. Monitor B immediately detects this violation at t=4, because on the third controller cycle setting f=5/2 violates
(91)
The fail-safe action at t=4 drains the tank and, after that, normal operation continues until t=12. Unexpected disturbance
(92)
occurs throughout t=[12, 14], which is detected by monitor X.sub.m. Note, that such a deviation would remain undetected with conventional approaches (monitor X.sub.c is completely unaware of the deviation). In this simulation run, the disturbance is small enough to let the fail-safe action at t=14 keep the water tank in a safe state.
Partially-Observable Systems
Monitor Synthesis for Verified Runtime Validation
(93) CPS are almost impossible to get right without sufficient attention to prior analysis, for instance by formal verification. Performed offline, these approaches result in a verified model of a CPS, i.e. Eq.(5) is proved valid, for example using the differential dynamic logic proof calculus implemented in KeYmaera X:
A.fwdarw.[α*]S (5)
(94) Eq. (5) expresses that all runs of the hybrid system α*, which starts in states that satisfy the precondition A and repeat a arbitrarily many times, only end in states that satisfy the postcondition S. The model α* is a hybrid system model of a CPS, which means that it describes both the discrete control actions of the controllers in the system and the continuous physics of the plant and the system's environment.
(95) Whether or not the control choices, actuator and environment effects are faithfully represented in the model can only be checked from actual measurements. Intuitively, such checks compare the values x in state v.sub.i−1 to the values x.sup.+ in state v.sub.i taken at successive sample times to determine compatibility of the unknown system behavior γ.sub.i−1 with model α* as shown in
(96) For example, values x=2 and x.sup.+=3 are compliant with the differential equation x′=2, because starting the program at x can produce x.sup.+, as witnessed by a proof of the d formula x=2∧x.sup.+=3.fwdarw.
x′=2
x.sup.+=x. No x.sup.+<x is compliant with the program, because the program can reach only states where x.sup.+≥x.
(97) ModelPlex, as described in U.S. patent application Ser. No. 15/026,690, provides the basis for obtaining such runtime checks from hybrid system models both automatically and in a provably correct manner. ModelPlex analyzes hybrid programs α, starting from monitor conditions in d of the form
α
γ.sup.+, where γ.sup.+ is a shortcut notation for x.sup.+=x for all x∈BV(α) to collect the effect of executing α. The satisfaction relation (w, v)
ϕ can be used to refer to a monitor condition that is satisfied over two states w and v.
(98) Definition 3 (Transition Satisfaction Relation).
(99) The satisfaction relation (w, v)ϕ of d
formula ϕ for a pair of states (w, v) evaluates ϕ in the state resulting from state w by interpreting variable x.sup.+ as v(x) for all x∈V, i.e., (w, v)
ϕiff w.sub.x.sub.
(100) The central correctness result about ModelPlex, as shown by Theorem 1, guarantees that the resulting monitoring formula preserves safety (i.e., if the monitoring formula evaluates to true with current sensor measurements and control choices, then the system is safe).
(101) In the following sections, the ModelPlex monitor synthesis techniques are advanced to account for actuator disturbance and sensor uncertainty in partially observable cases.
(102) Robustness to Actuator Disturbance
(103) Actuator disturbance results in discrepancies between the chosen control decisions u and their physical effect ũ (e.g., wheel slip). A typical pattern to model piecewise constant actuator disturbance chooses a nondeterministic value i in the Δ-neighborhood around the control choice u (but does not affect other state variables) as input to the plant: u:∈ctrl(x); ũ∈U.sub.Δ(u); x′=f(x,ũ).
(104) Actuator disturbance is partially observable by monitoring the difference between the intended effect x′=f(x, u) and the actual effect x′=f(x,ũ) from observable quantities. As a side effect, safety and invariant properties of models do not mention the perturbed actuator effect. For example, a car controller can estimate deviation from its acceleration choice only after the fact by observing the actual resulting speed difference. The safety property of interest is usually about the actual resulting speed and not the perturbed acceleration. For monitor synthesis, we therefore adapt the input-output relation γ.sup.+ to conjecture existence of an effective actuator effect ũ.sup.+ that explains all other effects collected in γ.sup.+ about a program α. The monitor condition, shown in Eq. (6), can be turned into arithmetical form with the prior synthesis process and preserves safety by Theorem 5.α
∃ũ.sup.+γ.sup.+ (6)
Theorem 5 (Monitor with Actuator Disturbance Preserves Invariants).
(105) Let α be a hybrid program of the shape u:∈ctrl(x); ũ∈U.sub.Δ(u); x′=f(x,ũ). Let α* preserve an invariant J where ũ.Math.FV(J), so J.fwdarw.[α]J is valid. Assume the system transitions from state w to v, which agree on BV(α).sup.C, and assume w∈[[J]]. If the monitor condition in Eq. (6) is satisfied (i.e., (w, v)α
∃ũ.sup.+γ.sup.+), then the invariant is preserved (i.e., v∈[[J]]).
(106) Theorem 5 extends to multiple control outputs u and their effects with disturbance ũ in a straightforward way. The controller u:∈ctrl(x) does not access u and ũ.Math.FV(J)
(107) is therefore natural as no information about l needs to be maintained in the invariant J.
(108) Partial Observability from Sensor Uncertainty
(109) Monitor correctness requires that all bound variables of a program α are monitored (i.e., BV(α).Math.FV(γ.sup.+)). This is the appropriate behavior except for variables that are unobservable in the CPS implementation. For example, when controllers use sensors to obtain information, only the measurement is known, but not the true value that the sensor is measuring. If a variable is unobservable then it cannot be included in a runtime monitor. But there may still be indirect implications about unobservable quantities when they are related to observable quantities, which necessitates monitors that indirectly check the properties of the true quantity from the measured quantity.
(110) Unobservability results in a crucial difference between monitoring and control (and its safety proofs). Controllers estimate true behavior by taking measurements and observing the effect of their decisions in the next measurements that are again taken from the true values. Monitors must decide whether the measurements explain a true behavior that fits to the expected behavior model.
(111) The measurements of a controller are taken from points that are linked through the underlying true behavior by assumption. Monitors cannot make this assumption, which results in a number of challenges that are discussed in this section: (i) check existence of behavior as explanation from a set of potential true values into a set of potential next true values; (ii) link explanations to a full path through sets of potential true values around a history of observations; and (iii) guarantee safety in both cases.
(112) y with y∈x is used to refer to an unobservable state variable and ŷ is used to denote a measurement of y with some uncertainty Δ, so ŷ∈U.sub.Δ(y). Assume non-faulty sensors that function according to their characteristics (i.e., they reliably deliver values that only deviate from the true values by at most some known sensor uncertainty Δ). In an implementation, sensor fusion methods for detecting sensor faults and correcting measurement outliers can satisfy this assumption. Definition 4 captures what it means for states to be similar with respect to a measurement that is subject to uncertainty.
(113) Definition 4 (Uncertainty Similarity).
(114) Use w{circumflex over (≈)}.sub.y.sup.Δ to denote the fact that w=v on {y}.sup.C with w(y)∈U.sub.Δ(v(ŷ)) and say that state w is Δ-uncertainty-similar to state v.
(115) In the following paragraphs, Δ-techniques are developed to synthesize monitors that indicate whether or not there exist states that are Δ-uncertainty-similar to measured states and connected through a program α, for measured states w and v do there exist uncertainty-similar states {tilde over (w)} and {tilde over (v)} such that {tilde over (w)}{circumflex over (≈)}.sub.y.sup.Δ, {tilde over (v)}{circumflex over (≈)}.sub.y.sup.Δv and
(116) Model Monitors for Pairwise Consistency of Measurements
(117) Monitoring based on measurements requires a decision as to whether the true values y fit to a model α by only looking at the measurements ŷ. Intuitively, this can be answered by finding an unobservable prior state y∈U.sub.Δ(ŷ) close to the measurement ŷ, such that running the model α on this possible y predicts a next unobservable y.sup.+ that is within measurement uncertainty y.sup.+∈U.sub.Δ(ŷ.sup.+) to the next measurement y.sup.+. This intuition is illustrated in
(118) The goal when formalizing this intuition into monitoring conditions is to shift proof effort offline. Therefore, offline proofs are combined with online monitoring: (i) offline proving that the modeled dynamics ensure that all potential true values around the measurements satisfy an invariant property for safety (contraction, see Definition 5); and (ii) online monitoring that some potential true values around the measurements can be connected with the modeled dynamics (See Eq. 7). Both requirements are expressible by quantifying over potential true values in d.
(119) Definition 5 (Contraction). The contraction ∀y∈U.sub.δ(ŷ)J of margin δ≥0 ensures ∀y∈U.sub.δ(ŷ)J (i.e. J for all potential values y in the δ-neighborhood of the value ŷ. Program β is contraction-safe for margin δ with measurement uncertainty Δ if ∀y∈U.sub.δ(ŷ)J.fwdarw.[u:∈β; x′=f(x, u);?t=ε; ŷ:∈U.sub.Δ(y)]∀y∈U.sub.δ(ŷ)J is valid.
(120) Monitor condition Eq.(7) answers the question of the plausibility of two measurements ŷ and ŷ.sup.+ taken t=∈ time apart according to the model dynamics by asking for existence of true values y and y.sup.+.
X.sub.m≡∃y∈U.sub.Δ(ŷ)u:∈ctrl(ŷ);x′=f(x,u);?t=ε;ŷ:∈U.sub.Δ(y)
(∃y.sup.+γ.sup.+) (7)
(121) To facilitate monitor synthesis, both measurements ŷ and ŷ.sup.+ are needed in a single loop iteration. Therefore, Eq.(7) takes fresh measurements after x′−f(x, u). Now monitor condition (7) indicates that there exist true values close to the measurements; for these true values to have the desired properties, the controller u:∈ctrl(ŷ) must be contraction-safe, as shown by Theorem 6.
(122) Theorem 6 (Pairwise Measurement Monitor Preserves Invariants).
(123) Let α be a program of the shape u:∈ctrl(ŷ); x′=f(x, u); ?t=ε; ŷ:∈U.sub.Δ(y) with contraction-safe controller u:∈ctrl(ŷ) for margin Δ and measurement uncertainty Δ (i.e., ∀y∈U.sub.δ(ŷ)J.fwdarw.[α]∀y∈U.sub.δ(ŷ)J) is valid. Assume the system transitions from w to v, which agree on BV(α).sup.C, with non-faulty sensors, so w∈[[y∈U.sub.Δ(ŷ)]] and v∈[[y∈U.sub.Δ(ŷ)]]. If the contraction holds w∈[[∀y∈U.sub.δ(ŷ)J]] and the pairwise measurement monitor satisfies (w, v)∃y∈U.sub.Δ(ŷ)(α)(∃y.sup.+y.sup.+) then J is preserved (i.e., v∈[[J]]).
(124) Theorem 6 extends to vectors of several unobservable variables y and their measured variables ŷ in a straightforward way. The test ?t=ε is reflected in monitor condition (7), so the monitor is only satisfied for states w and v according to the sampling interval ε (formally: v(t)=w(t)+ε for clock t′=1).
(125) Besides safety, monitoring for existence of unobservable values y that fit to the present measurements ŷ also guarantees that the variation between true values is bounded, but not that it forms a linked chain of model executions because true values are freshly estimated from only the last measurement (see
(126) Proposition 1 (Bounded Variation Coincidence).
(127) Let α be a hybrid program of the form u:∈ctrl(γ); x′=f(x, u); ?t=ε; ŷ:∈U.sub.Δ(y). Assume the system transitions through the sequence of states v.sub.0, v.sub.1, . . . , v.sub.n, which agree on BV(α).sup.C, such that (v.sub.i−1, v.sub.i)X.sub.m with Eq. (7) for all 1≤i≤n. Then there are w.sub.i−1{circumflex over (≈)}v.sub.i=1,μ{circumflex over (≈)}.sub.y.sup.Δv.sub.i such that (w.sub.i−1,μ.sub.i)∈[[α]].
(128) Proposition 2 and Corollary 1 bound the maximum variation between true values y and measurements ŷ that the monitor condition must allow according to the model.
(129) Proposition 2 (Single-Step Variation Distance).
(130) Let α be a hybrid program of the form u:∈ctrl(ŷ); x′=f(x, u); ?t=ε; ŷ:∈U.sub.Δ(y). Assume the model transitions (w, v)∈[[α]] with intermediate states μ and {tilde over (μ)}. such that (w,μ)∈[[u:∈ctrl(ŷ)]], (μ,{circumflex over (μ)})∈[[x′=f(x, u)]], and ({circumflex over (μ)}, v)∈[[ŷ∈U.sub.Δ(y)]]. If (w, v)X.sub.m then the variation distance in a single α-step is bounded: v(γ)∈U.sub.4Δ(w(y)+{circumflex over (μ)}(y)) and v(y)∈U.sub.3Δ(w(ŷ)+{circumflex over (μ)}(y)−μ(y)).
(131) Corollary 1 (Multi-Step Distance).
(132) Assume the model transitions through a sequence of states v.sub.0, v.sub.1, . . . , v.sub.n with intermediate states μ.sub.i and {circumflex over (μ)}.sub.i s.t. (v.sub.i−1,μ.sub.i)∈[[u:∈ctrl(ŷ)]], (μ.sub.i,{circumflex over (μ)}.sub.i)∈[[x′=f(x, u); ?t=ε]] and ({circumflex over (μ)}.sub.i, v.sub.i)∈[[ŷ∈U.sub.Δ(y)]]. If (v.sub.i−1, v.sub.i)X.sub.m for all 1≤i≤n then the variation is bounded: v.sub.n(y)∈U.sub.2Δ(n-1)(v.sub.0(y)+Σ.sub.i=1.sup.n({circumflex over (μ)}.sub.i(y)−μ.sub.i(y))).
(133) As a consequence of Proposition 2 and Corollary 1, Theorem 6 is useful for single-step consistency checks: such a monitor (i) keeps at least Δ>0 safety margin with a contraction-safe controller because otherwise freshly estimating true y from measurements on every iteration does not preserve invariants, and (ii) detects “large” deviations that occur in a single monitoring step. However, pairwise consistency is unable to detect gradual drift and therefore has to be safeguarded for its entire 2Δ(n+1) deviation over n steps, which inhibits motion, and cannot exploit improving the safety margin Δ over a history of measurements.
(134) Model Monitors for Rolling Consistency of Measurements
(135) Even if measurement pairs in isolation do not exceed the detectable single-step violation of the previous section, the resulting aggregated drift over multiple measurements is still detectable when we keep a history of the control choices. Instead of an explicit list of measurement and control choice histories, the actuation and measurement history can be aggregated into what really matters: acceptable bounds for the upcoming true values (area 902 in
(136) Definition 6 (Non-Diverging Rolling State Estimator).
(137) A rolling state estimator [l,u]:=e(ŷ.sub.0,ŷ,y−y.sub.0,Δ,[l.sub.0,u.sub.0] updates the estimate [l,u] from the previous measurement ŷ.sub.0, current measurement ŷ, the modeled interpolated plant effect y−y.sub.0 and the previous estimate [l.sub.0,u.sub.0] with y.sub.0∈U.sub.[l.sub.
(138) The rolling state estimator updates estimates y∈U.sub.[l,u](ŷ) of true y on every measurement such that the history of measurements is preserved in aggregate form. On each step, the monitor checks for existence of a true state y in the estimate and uses the rolling state estimator to incorporate the current measurement ŷ into the estimate for the next check. This also means that the plant effect y−y.sub.0 is existentially quantified in the monitor condition of Eq.(8) below, so does not need to be directly observable.
(139) The following basic rolling state estimator is non-diverging:
l=max(−Δ,ŷ.sub.0−ŷ+y−y.sub.0+l.sub.0)
u=max(−Δ,ŷ.sub.0−ŷ+y−y.sub.0+u.sub.0)
(140) For a sequence of n measurements, a non-diverging rolling state estimator keeps tighter bounds compared to the 2Δ(n+1) bounds of Corollary 1 without measurement history. Note that measurements typically vary due to sensor uncertainty, so the estimate almost surely even improves over time by observing measurements.
(141) The monitor condition (8) checks the plausibility of a history of measurements ŷ:∈U.sub.Δ(y) by estimating the true y∈U.sub.[l,u](ŷ) from the observations.
(142)
(143) The dynamics x′=f(x, u) over time are reflected by the rolling state estimator in the estimate y∈U.sub.[l,u](ŷ), which guarantees safety by Theorem 7.
(144) Theorem 7 (Monitor with rolling state estimator maintains invariants).
(145) Let α be a program of the form y.sub.0:=y; ŷ.sub.0=ŷ; u:∈ctrl(ŷ); x′=f(x, u); ?t=ε; ŷ:∈U.sub.Δ(γ); [l,u]:=e(ŷ.sub.0,ŷ,y−y.sub.0,Δ,[l.sub.0, u.sub.0]) with a contraction-safe program y.sub.0=y; ŷ.sub.0=ŷ; u:∈ctrl(ŷ) for margin [l,u] and measurement uncertainty Δ. Assume the system transitions from w to v, which agree on BV(α).sup.C, with non-faulty sensors, so both w∈[[y∈U.sub.Δ(ŷ)]] and v∈[[y∈U.sub.Δ(ŷ)]]. If w∈[[∀y∈U.sub.[l,u](ŷ)J]] and the monitor condition (8) is satisfied, i.e., (w, v)∃y∈U.sub.[l,u](ŷ)<α>(∃y.sup.+γ.sup.+), then the invariant J is maintained: v∈[[J]].
(146) Theorem 7 extends to vectors of several unobservable variables y and their measured variables ŷ in a straightforward way.
(147) In summary, the approach disclosed herein improves over existing runtime monitoring techniques with provably correct monitor conditions, explicit dynamics with sensor uncertainty and actuator disturbance, and shifts expensive computation offline.
(148) Specification—
(149) Other methods start from purely discrete monitor specifications and therefore the continuous dynamics are implicit and unchecked (e.g., a monitor specification “always positive distance to obstacles” has the implicit unrealistic assumption that a car can stop instantaneously from any speed). In contrast, the approach disclosed herein starts from safety requirements about dynamical hybrid system models with continuous dynamics and therefore synthesizes monitor specifications that are provably correct with respect to the dynamics model (e.g., a specification “always positive distance to obstacles” in the approach herein results in a monitor “always sufficient stopping distance” that acts ahead of time as opposed to after a collision).
(150) Assumptions Between Sampling Points—
(151) Methods that rely on discrete time or combine discrete-time with continuous-time descriptions require additional assumptions on the continuous dynamics between sampling points to be sound, which is handled in the approach herein explicitly, to characterize partial controllability and partial observability and to distinguish between deviation caused by mere uncertainty versus actually unsafe environment behavior.
(152) Offline Computation—
(153) Some methods rely on extensive runtime computations (e.g., reachable sets). The approach herein, in contrast, performs expensive computations offline. At runtime, the resulting formula is only evaluated in real arithmetic for concrete sensor values and control decisions, which enables fast enough responses.
(154) Crucially, the approach herein proves correctness properties that correctly link satisfied monitors to offline safety proofs, resulting in monitors that warn ahead offline, and account for partial controllability and partial observability so that the monitored system inherits the safety guarantees about the model.
(155) Provable guarantees about the safety of cyber-physical systems at runtime are crucial as systems become increasingly autonomous. Formal verification techniques provide an important basis by proving safety of CPS models, which then requires transferring the guarantees of offline proofs to system execution. The approach herein addresses the key question of how offline proofs transfer by runtime monitoring, and crucially, what property needs to be runtime-monitored to imply safety of the monitored system. The disclosed techniques significantly extend previous methods to models of practical interest by implementing proof tactics for differential dynamic logic that correctly synthesize monitor conditions that are robust to bounded sensor uncertainty and bounded actuator disturbance, which are both fundamental sources of partial observability in models.