Lecture 4. Formal specifications: LTL, CTL ELEC-E8110 Automation - - PowerPoint PPT Presentation

lecture 4 formal specifications ltl ctl
SMART_READER_LITE
LIVE PREVIEW

Lecture 4. Formal specifications: LTL, CTL ELEC-E8110 Automation - - PowerPoint PPT Presentation

Lecture 4. Formal specifications: LTL, CTL ELEC-E8110 Automation Systems Synthesis and Analysis Igor Buzhinsky igor.buzhinskii@aalto.fi 2018 Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 1 / 37 State (reachability) graph of


slide-1
SLIDE 1

Lecture 4. Formal specifications: LTL, CTL

ELEC-E8110 Automation Systems Synthesis and Analysis Igor Buzhinsky

igor.buzhinskii@aalto.fi

2018

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 1 / 37

slide-2
SLIDE 2

State (reachability) graph of a system

Nodes: all reachable states of the system If the system is modular, then the state of the system consists of the state of all its modules Directed edges: one-step evolutions of the state Multiple outgoing edges are possible from each state, i.e. nondeterminism is common

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 2 / 37

slide-3
SLIDE 3

State graph: example

NCES module (actually, a Petri net)

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 3 / 37

slide-4
SLIDE 4

State graph: example

NCES module (actually, a Petri net) State graph, state = p1p2p3

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 3 / 37

slide-5
SLIDE 5

Kripke structures

Formalization of a state graph Let AP be the a finite set of so-called atomic propositions Then M = (S, I, T, L) is a Kripke structure, where: S is a finite set of states I ⊂ S is a set of initial states T ⊂ S × S is a transition relation L : S → 2AP is a labeling function No deadlock assumption: ∀s ∈ S ∃s′ ∈ S : (s, s′) ∈ T

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 4 / 37

slide-6
SLIDE 6

State graph interpreted as a Kripke structure

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 5 / 37

slide-7
SLIDE 7

State graph interpreted as a Kripke structure

AP =

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 5 / 37

slide-8
SLIDE 8

State graph interpreted as a Kripke structure

AP = {“pi = j”|i = 1..3, j = 0..2} S:

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 5 / 37

slide-9
SLIDE 9

State graph interpreted as a Kripke structure

AP = {“pi = j”|i = 1..3, j = 0..2} S: nodes of this graph I ⊂ S =

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 5 / 37

slide-10
SLIDE 10

State graph interpreted as a Kripke structure

AP = {“pi = j”|i = 1..3, j = 0..2} S: nodes of this graph I ⊂ S = {101} Note: in UPPAAL and NCES models there is always one initial state! T ⊂ S × S:

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 5 / 37

slide-11
SLIDE 11

State graph interpreted as a Kripke structure

AP = {“pi = j”|i = 1..3, j = 0..2} S: nodes of this graph I ⊂ S = {101} Note: in UPPAAL and NCES models there is always one initial state! T ⊂ S × S: edges of the graph, e.g. (002, 011), (011, 002), ... L : S → 2AP:

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 5 / 37

slide-12
SLIDE 12

State graph interpreted as a Kripke structure

AP = {“pi = j”|i = 1..3, j = 0..2} S: nodes of this graph I ⊂ S = {101} Note: in UPPAAL and NCES models there is always one initial state! T ⊂ S × S: edges of the graph, e.g. (002, 011), (011, 002), ... L : S → 2AP: token assignments (markings) in each state, e.g. L(020) = {“p0 = 0”, “p1 = 2”, “p3 = 0”}

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 5 / 37

slide-13
SLIDE 13

State graph interpreted as a Kripke structure

AP = {“pi = j”|i = 1..3, j = 0..2} S: nodes of this graph I ⊂ S = {101} Note: in UPPAAL and NCES models there is always one initial state! T ⊂ S × S: edges of the graph, e.g. (002, 011), (011, 002), ... L : S → 2AP: token assignments (markings) in each state, e.g. L(020) = {“p0 = 0”, “p1 = 2”, “p3 = 0”} Specifications can be interpreted as predicates over Kripke structures

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 5 / 37

slide-14
SLIDE 14

Kripke structures / state graphs for UPPAAL models?

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 6 / 37

slide-15
SLIDE 15

Kripke structures / state graphs for UPPAAL models?

AP: whether a state machine is in a certain state, whether a variable has a certain value S:

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 6 / 37

slide-16
SLIDE 16

Kripke structures / state graphs for UPPAAL models?

AP: whether a state machine is in a certain state, whether a variable has a certain value S: (s1, ..., sk, v1, ..., vm) ∈ S if it is a reachable combination of states and variable values I ⊂ S:

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 6 / 37

slide-17
SLIDE 17

Kripke structures / state graphs for UPPAAL models?

AP: whether a state machine is in a certain state, whether a variable has a certain value S: (s1, ..., sk, v1, ..., vm) ∈ S if it is a reachable combination of states and variable values I ⊂ S: single initial state (s01, ..., s0k, v01, ..., v0m) composed of initial individual states and variable values T ⊂ S × S:

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 6 / 37

slide-18
SLIDE 18

Kripke structures / state graphs for UPPAAL models?

AP: whether a state machine is in a certain state, whether a variable has a certain value S: (s1, ..., sk, v1, ..., vm) ∈ S if it is a reachable combination of states and variable values I ⊂ S: single initial state (s01, ..., s0k, v01, ..., v0m) composed of initial individual states and variable values T ⊂ S × S: valid state transitions L : S → 2AP:

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 6 / 37

slide-19
SLIDE 19

Kripke structures / state graphs for UPPAAL models?

AP: whether a state machine is in a certain state, whether a variable has a certain value S: (s1, ..., sk, v1, ..., vm) ∈ S if it is a reachable combination of states and variable values I ⊂ S: single initial state (s01, ..., s0k, v01, ..., v0m) composed of initial individual states and variable values T ⊂ S × S: valid state transitions L : S → 2AP: individual states and variable values Note: we ignore timed capabilities of UPPAAL by now

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 6 / 37

slide-20
SLIDE 20

System behaviors are paths in Kripke structures

Infinite paths are common in formal

  • verification. This is the reason why

deadlocks are undesirable

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 7 / 37

slide-21
SLIDE 21

System behaviors are paths in Kripke structures

Infinite paths are common in formal

  • verification. This is the reason why

deadlocks are undesirable What happens in terms of the

  • riginal system?

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 7 / 37

slide-22
SLIDE 22

Single behavior view

Assume that now we have only two atomic propositions: p and q All possible behaviors are infinite sequences over 2{p,q} Example: {p, q}, {p}, {}, cycle({q}, {p, q})

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 8 / 37

slide-23
SLIDE 23

Single behavior view

Assume that now we have only two atomic propositions: p and q All possible behaviors are infinite sequences over 2{p,q} Example: {p, q}, {p}, {}, cycle({q}, {p, q}) Boolean logic is able to characterize single elements of such sequences Can we somehow introduce predicates over infinite sequences of atomic propositions? For example, to formulate a specification: each p is followed by ¬p on the next step (which is false for the example)

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 8 / 37

slide-24
SLIDE 24

Linear temporal logic (LTL)

Formal language which extends the usual propositional Boolean logic Variables: atomic propositions, e.g. p and q Usual Boolean operators are allowed, e.g. p → q (i.e. ¬p ∨ q) is an LTL formula, but it refers to the first element of an infinite sequence

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 9 / 37

slide-25
SLIDE 25

Linear temporal logic (LTL)

Formal language which extends the usual propositional Boolean logic Variables: atomic propositions, e.g. p and q Usual Boolean operators are allowed, e.g. p → q (i.e. ¬p ∨ q) is an LTL formula, but it refers to the first element of an infinite sequence Temporal operators

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 9 / 37

slide-26
SLIDE 26

Linear temporal logic (LTL)

Formal language which extends the usual propositional Boolean logic Variables: atomic propositions, e.g. p and q Usual Boolean operators are allowed, e.g. p → q (i.e. ¬p ∨ q) is an LTL formula, but it refers to the first element of an infinite sequence Temporal operators G: globally (always), e.g. G(p → q) means “in each element of the sequence, p → q holds”

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 9 / 37

slide-27
SLIDE 27

Linear temporal logic (LTL)

Formal language which extends the usual propositional Boolean logic Variables: atomic propositions, e.g. p and q Usual Boolean operators are allowed, e.g. p → q (i.e. ¬p ∨ q) is an LTL formula, but it refers to the first element of an infinite sequence Temporal operators G: globally (always), e.g. G(p → q) means “in each element of the sequence, p → q holds” F: in the future, e.g. F(p → q) means “for some element of the sequence, p → q holds”

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 9 / 37

slide-28
SLIDE 28

Linear temporal logic (LTL)

Formal language which extends the usual propositional Boolean logic Variables: atomic propositions, e.g. p and q Usual Boolean operators are allowed, e.g. p → q (i.e. ¬p ∨ q) is an LTL formula, but it refers to the first element of an infinite sequence Temporal operators G: globally (always), e.g. G(p → q) means “in each element of the sequence, p → q holds” F: in the future, e.g. F(p → q) means “for some element of the sequence, p → q holds” X: on the next step, e.g. X(p → q) means “p → q holds for the second element of the sequence”

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 9 / 37

slide-29
SLIDE 29

Linear temporal logic (LTL)

Formal language which extends the usual propositional Boolean logic Variables: atomic propositions, e.g. p and q Usual Boolean operators are allowed, e.g. p → q (i.e. ¬p ∨ q) is an LTL formula, but it refers to the first element of an infinite sequence Temporal operators G: globally (always), e.g. G(p → q) means “in each element of the sequence, p → q holds” F: in the future, e.g. F(p → q) means “for some element of the sequence, p → q holds” X: on the next step, e.g. X(p → q) means “p → q holds for the second element of the sequence” U: until (binary operator), e.g. p U q means “q must happen at some step, and the sequence must satisfy p until (non-inclusive) q happens”

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 9 / 37

slide-30
SLIDE 30

Examples of LTL formulae

Path 1: {p, q}, {p}, {}, cycle({q}, {p, q}) Path 2: cycle({p, q}) Path 3: {}, cycle({p}, {p, q}, {q}) f1 = G p

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 10 / 37

slide-31
SLIDE 31

Examples of LTL formulae

Path 1: {p, q}, {p}, {}, cycle({q}, {p, q}) Path 2: cycle({p, q}) Path 3: {}, cycle({p}, {p, q}, {q}) f1 = G p – path 2 f2 = F(¬p ∧ ¬q)

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 10 / 37

slide-32
SLIDE 32

Examples of LTL formulae

Path 1: {p, q}, {p}, {}, cycle({q}, {p, q}) Path 2: cycle({p, q}) Path 3: {}, cycle({p}, {p, q}, {q}) f1 = G p – path 2 f2 = F(¬p ∧ ¬q) – paths 1, 3 f3 = p U(¬p ∧ ¬q)

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 10 / 37

slide-33
SLIDE 33

Examples of LTL formulae

Path 1: {p, q}, {p}, {}, cycle({q}, {p, q}) Path 2: cycle({p, q}) Path 3: {}, cycle({p}, {p, q}, {q}) f1 = G p – path 2 f2 = F(¬p ∧ ¬q) – paths 1, 3 f3 = p U(¬p ∧ ¬q) – paths 1, 3 Temporal operators can be applied to arbitrary LTL formulae! f4 = X X X X p

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 10 / 37

slide-34
SLIDE 34

Examples of LTL formulae

Path 1: {p, q}, {p}, {}, cycle({q}, {p, q}) Path 2: cycle({p, q}) Path 3: {}, cycle({p}, {p, q}, {q}) f1 = G p – path 2 f2 = F(¬p ∧ ¬q) – paths 1, 3 f3 = p U(¬p ∧ ¬q) – paths 1, 3 Temporal operators can be applied to arbitrary LTL formulae! f4 = X X X X p (“on the fifth step”) – paths 1, 2, 3 f5 = F G(p ∧ q)

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 10 / 37

slide-35
SLIDE 35

Examples of LTL formulae

Path 1: {p, q}, {p}, {}, cycle({q}, {p, q}) Path 2: cycle({p, q}) Path 3: {}, cycle({p}, {p, q}, {q}) f1 = G p – path 2 f2 = F(¬p ∧ ¬q) – paths 1, 3 f3 = p U(¬p ∧ ¬q) – paths 1, 3 Temporal operators can be applied to arbitrary LTL formulae! f4 = X X X X p (“on the fifth step”) – paths 1, 2, 3 f5 = F G(p ∧ q) (“globally from some point”) – path 2 f6 = G F(p ∧ q)

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 10 / 37

slide-36
SLIDE 36

Examples of LTL formulae

Path 1: {p, q}, {p}, {}, cycle({q}, {p, q}) Path 2: cycle({p, q}) Path 3: {}, cycle({p}, {p, q}, {q}) f1 = G p – path 2 f2 = F(¬p ∧ ¬q) – paths 1, 3 f3 = p U(¬p ∧ ¬q) – paths 1, 3 Temporal operators can be applied to arbitrary LTL formulae! f4 = X X X X p (“on the fifth step”) – paths 1, 2, 3 f5 = F G(p ∧ q) (“globally from some point”) – path 2 f6 = G F(p ∧ q) (“infinitely often”) – paths 1, 2, 3 f7 = G(p → X q)

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 10 / 37

slide-37
SLIDE 37

Examples of LTL formulae

Path 1: {p, q}, {p}, {}, cycle({q}, {p, q}) Path 2: cycle({p, q}) Path 3: {}, cycle({p}, {p, q}, {q}) f1 = G p – path 2 f2 = F(¬p ∧ ¬q) – paths 1, 3 f3 = p U(¬p ∧ ¬q) – paths 1, 3 Temporal operators can be applied to arbitrary LTL formulae! f4 = X X X X p (“on the fifth step”) – paths 1, 2, 3 f5 = F G(p ∧ q) (“globally from some point”) – path 2 f6 = G F(p ∧ q) (“infinitely often”) – paths 1, 2, 3 f7 = G(p → X q) (“p is always followed by q”) – paths 2, 3

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 10 / 37

slide-38
SLIDE 38

Path visualization tool

Download from https://github.com/igor-buzhinsky/nusmv_ counterexample_visualizer The tool supports interpreting counterexamples produced by NuSMV (will be covered later in the course), but can also be used to structurally explain LTL formula values on user-specified paths Important atomic propositions are highlighted Variable view: suppose that the state of the formal model is composed on a number of variables, either Boolean or integer Boolean variables can be interpreted as atomic propositions right away Statements over integer variables (e.g. comparisons like x > 5) can also be interepreted as atomic propositions

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 11 / 37

slide-39
SLIDE 39

Path visualization tool: example

Visualize G(p → X q) on path {p, q}, {p}, {}, cycle({q}, {p, q}):

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 12 / 37

slide-40
SLIDE 40

Path visualization tool: input format

  • - specification

G (p -> X q)

  • > new state <-

p = TRUE q = TRUE

  • > new state <-

p = TRUE q = FALSE

  • > new state <-

p = FALSE q = FALSE

  • - Loop starts here
  • > new state <-

p = FALSE q = TRUE

  • > new state <-

p = TRUE q = TRUE

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 13 / 37

slide-41
SLIDE 41

LTL: simplification and equivalence rules

G G f = G f F F f = F f

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 14 / 37

slide-42
SLIDE 42

LTL: simplification and equivalence rules

G G f = G f F F f = F f G X f = X G f F X f = X F f

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 14 / 37

slide-43
SLIDE 43

LTL: simplification and equivalence rules

G G f = G f F F f = F f G X f = X G f F X f = X F f ¬ G(f ) = F(¬f ) ¬ F(f ) = G(¬f )

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 14 / 37

slide-44
SLIDE 44

LTL verification: definition

Kripke structure M satisfies LTL formula f (written: M | = f ), if all paths in M which start in M’s initial states satisfy f

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 15 / 37

slide-45
SLIDE 45

LTL verification: definition

Kripke structure M satisfies LTL formula f (written: M | = f ), if all paths in M which start in M’s initial states satisfy f Quiz: which of these LTL formulae are satisfied by the KS on the right? Why? f1 = G p f2 = F(¬p ∧ ¬q) f3 = p U(¬p ∧ ¬q) f4 = X X X X p f5 = F G(p ∧ q) f6 = G F(p ∧ q) f7 = G(p → X q)

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 15 / 37

slide-46
SLIDE 46

Quiz answers

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 16 / 37

slide-47
SLIDE 47

Quiz answers

Only f6 = G F(p ∧ q)

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 16 / 37

slide-48
SLIDE 48

LTL verification: model checking algorithm

We wish to check whether f holds for Kripke structure M Automata-theoretic approach ¬f is converted to a so-called B¨ uchi automaton, which is an acceptor over infinite words which satisfy ¬f M is composed with this automaton If the composition accepts at least one infinite word, then this word satisfies ¬f and belongs to M, so f is false, and the obtained word is a counterexample Otherwise, f is true We won’t go into details

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 17 / 37

slide-49
SLIDE 49

Two cylinders system

The extension of each cylinder is discretized into four intervals When both cylinders share interval 4, they collide A workpiece can be placed into the shared interval If a cylinder reaches interval 4 and there is a workpiece, it is pushed

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 18 / 37

slide-50
SLIDE 50

LTL specification for the two cylinders system: plant model

Atomic propositions: h1, h2, h3, h4 (displacements of the horizonal cylinder), v1, v2, v3, v4 (displacements of the vertical cylinder), w (workpiece is present) Cylinder has a position:

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 19 / 37

slide-51
SLIDE 51

LTL specification for the two cylinders system: plant model

Atomic propositions: h1, h2, h3, h4 (displacements of the horizonal cylinder), v1, v2, v3, v4 (displacements of the vertical cylinder), w (workpiece is present) Cylinder has a position: G(h1 ∨ h2 ∨ h3 ∨ h4), G(v1 ∨ v2 ∨ v3 ∨ v4) Cylinder can’t have more than one position:

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 19 / 37

slide-52
SLIDE 52

LTL specification for the two cylinders system: plant model

Atomic propositions: h1, h2, h3, h4 (displacements of the horizonal cylinder), v1, v2, v3, v4 (displacements of the vertical cylinder), w (workpiece is present) Cylinder has a position: G(h1 ∨ h2 ∨ h3 ∨ h4), G(v1 ∨ v2 ∨ v3 ∨ v4) Cylinder can’t have more than one position: G(¬(h1∧h2)∧¬(h1∧h3)∧¬(h1∧h4)∧¬(h2∧h3)∧¬(h2∧h4)∧¬(h3∧h4)), G(¬(v1∧v2)∧¬(v1∧v3)∧¬(v1∧v4)∧¬(v2∧v3)∧¬(v2∧v4)∧¬(v3∧v4)) If a cylinder is fully extended, then there is no workpiece:

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 19 / 37

slide-53
SLIDE 53

LTL specification for the two cylinders system: plant model

Atomic propositions: h1, h2, h3, h4 (displacements of the horizonal cylinder), v1, v2, v3, v4 (displacements of the vertical cylinder), w (workpiece is present) Cylinder has a position: G(h1 ∨ h2 ∨ h3 ∨ h4), G(v1 ∨ v2 ∨ v3 ∨ v4) Cylinder can’t have more than one position: G(¬(h1∧h2)∧¬(h1∧h3)∧¬(h1∧h4)∧¬(h2∧h3)∧¬(h2∧h4)∧¬(h3∧h4)), G(¬(v1∧v2)∧¬(v1∧v3)∧¬(v1∧v4)∧¬(v2∧v3)∧¬(v2∧v4)∧¬(v3∧v4)) If a cylinder is fully extended, then there is no workpiece: G(h4 ∨ v4 → ¬w) ... Such specifications can help “debug” the plant model

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 19 / 37

slide-54
SLIDE 54

LTL specification for the two cylinders system: requirements for the controller

We won’t use any additional atomic propositions: all we need can be specified in terms of the plant!

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 20 / 37

slide-55
SLIDE 55

LTL specification for the two cylinders system: requirements for the controller

We won’t use any additional atomic propositions: all we need can be specified in terms of the plant! Cylinders do not collide:

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 20 / 37

slide-56
SLIDE 56

LTL specification for the two cylinders system: requirements for the controller

We won’t use any additional atomic propositions: all we need can be specified in terms of the plant! Cylinders do not collide: G ¬(h4 ∧ v4)

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 20 / 37

slide-57
SLIDE 57

LTL specification for the two cylinders system: requirements for the controller

We won’t use any additional atomic propositions: all we need can be specified in terms of the plant! Cylinders do not collide: G ¬(h4 ∧ v4) When a workpiece appears, it must be eventually pushed away:

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 20 / 37

slide-58
SLIDE 58

LTL specification for the two cylinders system: requirements for the controller

We won’t use any additional atomic propositions: all we need can be specified in terms of the plant! Cylinders do not collide: G ¬(h4 ∧ v4) When a workpiece appears, it must be eventually pushed away: G(w → F ¬w)

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 20 / 37

slide-59
SLIDE 59

LTL specification for the two cylinders system: requirements for the controller

We won’t use any additional atomic propositions: all we need can be specified in terms of the plant! Cylinders do not collide: G ¬(h4 ∧ v4) When a workpiece appears, it must be eventually pushed away: G(w → F ¬w) Cylinders iterate (each new workpiece is pushed by a different cylinder):

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 20 / 37

slide-60
SLIDE 60

LTL specification for the two cylinders system: requirements for the controller

We won’t use any additional atomic propositions: all we need can be specified in terms of the plant! Cylinders do not collide: G ¬(h4 ∧ v4) When a workpiece appears, it must be eventually pushed away: G(w → F ¬w) Cylinders iterate (each new workpiece is pushed by a different cylinder): G((h4∧(X ¬h4)∧F w) → X((¬w∧¬v4∧¬h4) U(w∧(w U(v4∧¬h4))))), and the same for the other cylinder

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 20 / 37

slide-61
SLIDE 61

Computation tree logic (CTL)

In LTL, there is always an implicit quantification over all paths starting in initial states In CTL, all temporal operators are annotated with quantifiers CTL formulae characterize not infinite sequences, but rather states of the Kripke structure A Kripke structure satisfies a CTL formula, if all its initial states satisfy this formula Let s be a state of the KS, then s | = f means s satisfies f

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 21 / 37

slide-62
SLIDE 62

CTL: temporal operator EX

s | = EX(f ) (“exists next”, not supported by UPPAAL): there is a successor of s where f holds

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 22 / 37

slide-63
SLIDE 63

CTL: temporal operator AX

s | = AX(f ) (“for all next”, not supported by UPPAAL): in all successors of s, f holds

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 23 / 37

slide-64
SLIDE 64

CTL: temporal operator EF

s | = EF(f ) (“exists in the future”, E<> in UPPAAL): there exists a path starting in s such that f becomes valid at some point of this path

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 24 / 37

slide-65
SLIDE 65

CTL: temporal operator AF

s | = AF(f ) (“for all in the future”, A<> in UPPAAL): for all possible paths starting in s, f becomes true at some point

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 25 / 37

slide-66
SLIDE 66

CTL: temporal operator EG

s | = EG(f ) (“exists globally”, E[] in UPPAAL): there exists a path starting in s such that f holds at every state along this path

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 26 / 37

slide-67
SLIDE 67

CTL: temporal operator AG

s | = AG(f ) (“for all globally”, A[] in UPPAAL): for all possible paths starting in s, f is always true

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 27 / 37

slide-68
SLIDE 68

CTL: temporal operators EU and AU

s | = f EU g (“exists until”, not supported by UPPAAL): there exists a path starting in s such that f holds until (non-inclusive) g, and g eventually happens s | = f AU g (“for all until”, not supported by UPPAAL): for all possible paths starting in s, f holds until (non-inclusive) g, and g eventually happens

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 28 / 37

slide-69
SLIDE 69

Are these formulae syntactically correct in LTL or CTL?

p ∧ ¬q

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 29 / 37

slide-70
SLIDE 70

Are these formulae syntactically correct in LTL or CTL?

p ∧ ¬q – both LTL and CTL

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 29 / 37

slide-71
SLIDE 71

Are these formulae syntactically correct in LTL or CTL?

p ∧ ¬q – both LTL and CTL AX(p → F q)

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 29 / 37

slide-72
SLIDE 72

Are these formulae syntactically correct in LTL or CTL?

p ∧ ¬q – both LTL and CTL AX(p → F q) – incorrect

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 29 / 37

slide-73
SLIDE 73

Are these formulae syntactically correct in LTL or CTL?

p ∧ ¬q – both LTL and CTL AX(p → F q) – incorrect F X AG q

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 29 / 37

slide-74
SLIDE 74

Are these formulae syntactically correct in LTL or CTL?

p ∧ ¬q – both LTL and CTL AX(p → F q) – incorrect F X AG q – incorrect

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 29 / 37

slide-75
SLIDE 75

Are these formulae syntactically correct in LTL or CTL?

p ∧ ¬q – both LTL and CTL AX(p → F q) – incorrect F X AG q – incorrect EX AG q

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 29 / 37

slide-76
SLIDE 76

Are these formulae syntactically correct in LTL or CTL?

p ∧ ¬q – both LTL and CTL AX(p → F q) – incorrect F X AG q – incorrect EX AG q – CTL

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 29 / 37

slide-77
SLIDE 77

Are these formulae syntactically correct in LTL or CTL?

p ∧ ¬q – both LTL and CTL AX(p → F q) – incorrect F X AG q – incorrect EX AG q – CTL EX ¬ AG q

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 29 / 37

slide-78
SLIDE 78

Are these formulae syntactically correct in LTL or CTL?

p ∧ ¬q – both LTL and CTL AX(p → F q) – incorrect F X AG q – incorrect EX AG q – CTL EX ¬ AG q – CTL

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 29 / 37

slide-79
SLIDE 79

Are these formulae syntactically correct in LTL or CTL?

p ∧ ¬q – both LTL and CTL AX(p → F q) – incorrect F X AG q – incorrect EX AG q – CTL EX ¬ AG q – CTL G(p → X X F q)

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 29 / 37

slide-80
SLIDE 80

Are these formulae syntactically correct in LTL or CTL?

p ∧ ¬q – both LTL and CTL AX(p → F q) – incorrect F X AG q – incorrect EX AG q – CTL EX ¬ AG q – CTL G(p → X X F q) – LTL

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 29 / 37

slide-81
SLIDE 81

Are these formulae syntactically correct in LTL or CTL?

p ∧ ¬q – both LTL and CTL AX(p → F q) – incorrect F X AG q – incorrect EX AG q – CTL EX ¬ AG q – CTL G(p → X X F q) – LTL (AX p) U(EF ¬p)

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 29 / 37

slide-82
SLIDE 82

Are these formulae syntactically correct in LTL or CTL?

p ∧ ¬q – both LTL and CTL AX(p → F q) – incorrect F X AG q – incorrect EX AG q – CTL EX ¬ AG q – CTL G(p → X X F q) – LTL (AX p) U(EF ¬p) – incorrect

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 29 / 37

slide-83
SLIDE 83

CTL verification: example

KS satisfies the CTL formula iff all its initial states satisfy it

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 30 / 37

slide-84
SLIDE 84

CTL verification: example

KS satisfies the CTL formula iff all its initial states satisfy it Which of these CTL formulae are satisfied by the KS on the right? Why? f1 = AG p f2 = AG(p ∨ q) f3 = AF(p ∧ q) f4 = EF(¬p ∧ ¬q) f5 = AX AX AX AX p f6 = EF EG(p ∧ q) f7 = EG EF(p ∧ q) f8 = AG(p → AX q)

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 30 / 37

slide-85
SLIDE 85

CTL verification: example

KS satisfies the CTL formula iff all its initial states satisfy it Which of these CTL formulae are satisfied by the KS on the right? Why? f1 = AG p f2 = AG(p ∨ q) f3 = AF(p ∧ q) f4 = EF(¬p ∧ ¬q) f5 = AX AX AX AX p f6 = EF EG(p ∧ q) f7 = EG EF(p ∧ q) f8 = AG(p → AX q) Answer:

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 30 / 37

slide-86
SLIDE 86

CTL verification: example

KS satisfies the CTL formula iff all its initial states satisfy it Which of these CTL formulae are satisfied by the KS on the right? Why? f1 = AG p f2 = AG(p ∨ q) f3 = AF(p ∧ q) f4 = EF(¬p ∧ ¬q) f5 = AX AX AX AX p f6 = EF EG(p ∧ q) f7 = EG EF(p ∧ q) f8 = AG(p → AX q) Answer: f2, f3, f6, f7

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 30 / 37

slide-87
SLIDE 87

CTL verification: model checking algorithms

Graph theory approach If f is just a Boolean formula, then it is trivial to check whether it holds in a desired state AX f holds in s, if we previously found that f holds for each in all its successors Similar (sometimes more complex) ideas for other operators We won’t go into details Symbolic approach Implicit representation of states via Boolean formulae Allows partial mitigation of the state explosion problem The symbolic approach will be examined in more detail later in the course

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 31 / 37

slide-88
SLIDE 88

CTL verification: two cylinders

Atomic propositions: h1..h4, v1..v4, w Quiz: specify the following properties in CTL: If a cylinder is fully extended, then there is no workpiece Cylinders do not collide When a workpiece appears, it must be eventually pushed away Cylinders iterate

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 32 / 37

slide-89
SLIDE 89

Quiz answers

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 33 / 37

slide-90
SLIDE 90

Quiz answers

If a cylinder is fully extended, then there is no workpiece: AG(h4 ∨ v4 → ¬w) Cylinders do not collide: AG ¬(h4 ∧ v4) When a workpiece appears, it must be eventually pushed away: AG(w → AF ¬w) Cylinders iterate: ???

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 33 / 37

slide-91
SLIDE 91

Common specification types (“patterns”)

Name LTL CTL Generality / Invariance G f AG f Bounded response G(p → Xn q) AG(p → (AX)nq) Unbounded response G(p → F q) AG(p → AF q) Infinitely often G F p AG AF p

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 34 / 37

slide-92
SLIDE 92

There are properties which cannot be expressed in both LTL and CTL

G p/ AG p, F p/ AF p, G F p/ AG AF p – both LTL and CTL EF p – only CTL, but there is a workaround to check it in LTL! F G p – only LTL AG EF p – only CTL CTL* is a larger logic which allows combining quantified and unquantified temporal operators

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 35 / 37

slide-93
SLIDE 93

Tool support

UPPAAL: a subset of CTL, some LTL properties can be specified with automata NuSMV: both CTL and LTL SPIN: LTL

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 36 / 37

slide-94
SLIDE 94

Literature

1 Baier, C., & Katoen, J. P. (2008). Principles of model checking. MIT

press.

2 Clarke, E. M., Grumberg, O., & Peled, D. (1999). Model checking.

MIT press.

3 Schneider, K. (2013). Verification of reactive systems: formal

methods and algorithms. Springer Science & Business Media.

Igor Buzhinsky Lecture 4. Formal specifications: LTL, CTL 2018 37 / 37