• Non ci sono risultati.

Formal Methods Module II: Model Checking Ch. 10: SMT-Based Model Checking

N/A
N/A
Protected

Academic year: 2021

Condividi "Formal Methods Module II: Model Checking Ch. 10: SMT-Based Model Checking"

Copied!
90
0
0

Testo completo

(1)

Formal Methods Module II: Model Checking

Ch. 10: SMT-Based Model Checking

Roberto Sebastiani

DISI, Università di Trento, Italy – roberto.sebastiani@unitn.it URL: http://disi.unitn.it/rseba/DIDATTICA/fm2021/

Teaching assistant:Giuseppe Spallitta– giuseppe.spallitta@unitn.it

M.S. in Computer Science, Mathematics, & Artificial Intelligence Systems Academic year 2020-2021

last update: Tuesday 1stJune, 2021, 11:34

Copyright notice: some material (text, figures) displayed in these slides is courtesy of R. Alur, M. Benerecetti, A. Cimatti,

(2)

Outline

1 Motivations & Context

2 Background

3 SMT-Based Bounded Model Checking of Timed Systems Basic Ideas

Basic Encoding

Improved & Extended Encoding A Case-Study

4 Exercises

(3)

Outline

1 Motivations & Context

2 Background

3 SMT-Based Bounded Model Checking of Timed Systems Basic Ideas

Basic Encoding

Improved & Extended Encoding A Case-Study

4 Exercises

(4)

Motivations

Model Checking for Timed Systems:

relevant improvements and results over the last decades historically, “explicit-state” search style, based on DBMs

notable examples: Kronos,Uppaal

More recently, symbolic verification techniques:

extensions of decision diagrams CDD,DDD,RED, ...

Key problem: potential blow up in size

A more recent and viable alternative to Binary Decision Diagrams: SAT-based MC

Bounded Model Checking (BMC), K-induction, IC3/PDR, ...

(5)

Motivations

Model Checking for Timed Systems:

relevant improvements and results over the last decades historically, “explicit-state” search style, based on DBMs

notable examples: Kronos,Uppaal

More recently, symbolic verification techniques:

extensions of decision diagrams CDD,DDD,RED, ...

Key problem: potential blow up in size

A more recent and viable alternative to Binary Decision Diagrams: SAT-based MC

Bounded Model Checking (BMC), K-induction, IC3/PDR, ...

(6)

Motivations

Model Checking for Timed Systems:

relevant improvements and results over the last decades historically, “explicit-state” search style, based on DBMs

notable examples: Kronos,Uppaal

More recently, symbolic verification techniques:

extensions of decision diagrams CDD,DDD,RED, ...

Key problem: potential blow up in size

A more recent and viable alternative to Binary Decision Diagrams: SAT-based MC

Bounded Model Checking (BMC), K-induction, IC3/PDR, ...

(7)

Motivations

Model Checking for Timed Systems:

relevant improvements and results over the last decades historically, “explicit-state” search style, based on DBMs

notable examples: Kronos,Uppaal

More recently, symbolic verification techniques:

extensions of decision diagrams CDD,DDD,RED, ...

Key problem: potential blow up in size

A more recent and viable alternative to Binary Decision Diagrams: SAT-based MC

Bounded Model Checking (BMC), K-induction, IC3/PDR, ...

(8)

Context

First Idea: SMT-based BMC of Timed Systems

[Audemard et al. 2002],[Sorea, MTCS’02],[Niebert et al.,FTRTFT’02]

Leverage the SAT-based BMC approach to Timed Systems by means ofSMT Solvers

Extensions

SMT eventually applied to other SAT-based MC techniques K-Induction

interpolant-based IC3/PDR

SMT applied to a variety of domains:

hybrid systems

verification of SW (loop invariants/proof obbligations, ...) hardware verification

Nowadays SMT leading backend technology for FV

(9)

Context

First Idea: SMT-based BMC of Timed Systems

[Audemard et al. 2002],[Sorea, MTCS’02],[Niebert et al.,FTRTFT’02]

Leverage the SAT-based BMC approach to Timed Systems by means ofSMT Solvers

Extensions

SMT eventually applied to other SAT-based MC techniques K-Induction

interpolant-based IC3/PDR

SMT applied to a variety of domains:

hybrid systems

verification of SW (loop invariants/proof obbligations, ...) hardware verification

Nowadays SMT leading backend technology for FV

(10)

Context

First Idea: SMT-based BMC of Timed Systems

[Audemard et al. 2002],[Sorea, MTCS’02],[Niebert et al.,FTRTFT’02]

Leverage the SAT-based BMC approach to Timed Systems by means ofSMT Solvers

Extensions

SMT eventually applied to other SAT-based MC techniques K-Induction

interpolant-based IC3/PDR

SMT applied to a variety of domains:

hybrid systems

verification of SW (loop invariants/proof obbligations, ...) hardware verification

Nowadays SMT leading backend technology for FV

(11)

Context

First Idea: SMT-based BMC of Timed Systems

[Audemard et al. 2002],[Sorea, MTCS’02],[Niebert et al.,FTRTFT’02]

Leverage the SAT-based BMC approach to Timed Systems by means ofSMT Solvers

Extensions

SMT eventually applied to other SAT-based MC techniques K-Induction

interpolant-based IC3/PDR

SMT applied to a variety of domains:

hybrid systems

verification of SW (loop invariants/proof obbligations, ...) hardware verification

Nowadays SMT leading backend technology for FV

(12)

Context

First Idea: SMT-based BMC of Timed Systems

[Audemard et al. 2002],[Sorea, MTCS’02],[Niebert et al.,FTRTFT’02]

Leverage the SAT-based BMC approach to Timed Systems by means ofSMT Solvers

Extensions

SMT eventually applied to other SAT-based MC techniques K-Induction

interpolant-based IC3/PDR

SMT applied to a variety of domains:

hybrid systems

verification of SW (loop invariants/proof obbligations, ...) hardware verification

Nowadays SMT leading backend technology for FV

(13)

Outline

1 Motivations & Context

2 Background

3 SMT-Based Bounded Model Checking of Timed Systems Basic Ideas

Basic Encoding

Improved & Extended Encoding A Case-Study

4 Exercises

(14)

Bounded Model Checking

[Biere et al., TACAS’99]

Given a Kripke Structure M, an LTL property f and an integer bound k , is there an execution path of M of length (up to) k satisfying f ? (M |=k Ef)

Problem converted into the satisfiability of the Boolean formula:

[[M]]fk :=I(s(0)) ∧

k −1

^

i=0

R(s(i),s(i+1)) ∧ (¬Lk ∧ [[f ]]0k) ∨

k

_

l=0

(lLkl[[f ]]0k)

s.t. lLk =defR(s(k ),s(l)), Lk def=Wk l=0 lLk

A satisfying assignment represents a satisfying execution path.

Test repeated for increasing values of k Incomplete

Very effective for debugging, alternative to OBDDs Complemented withK-Induction[Sheeran et al. 2000]

Further developments: IC3/PDR[Bradley, VMCAI 2011]

(15)

General Encoding for LTL Formulae

f [[f ]]ik l[[f ]]ik

p p(i) p(i)

¬p ¬p(i) ¬p(i)

h ∧ g [[h]]ik ∧ [[g]]ik l[[h]]ik l[[g]]ik h ∨ g [[h]]ik ∨ [[g]]ik l[[h]]ik l[[g]]ik

Xg [[g]]i+1k if i < k

otherwise.

l[[g]]i+1k if i < k

l[[g]]lk otherwise.

Gg Vk

j=min(i,l) l[[g]]jk Fg Wk

j=i [[g]]jk Wk

j=min(i,l) l[[g]]jk hUg Wk

j=i



[[g]]jkVj−1 n=i [[h]]nk

Wk j=i



l[[g]]jkVj−1 n=i l[[h]]nk

Wi−1

j=l



l[[g]]jkVk

n=i l[[h]]nkVj−1 n=l l[[h]]nk hRg Wk

j=i



[[h]]jkVj

n=i [[g]]nk Vk

j=min(i,l) l[[g]]jk Wk

j=i



l[[h]]jkVj

n=i l[[g]]nk

Wi−1

[[h]]j Vk

[[g]]nVj

[[g]]n

(16)

Timed Automata

[Alur and Dill, TCS’94; Alur, CAV’99]

T12

T21 x<=3 x>=1

x:=0 x <= 2

a

b

l1 l2

Clocks: real variables (ex. x) Locations:

label: (ex.l1),

invariants: (conjunctive) constraints on clocks values (ex.x ≤ 2) Switches:

event labels(ex.a),

clock constraints(ex.x ≥ 1), reset statements(ex. x := 0)

Time elapse: all clocks are increased by the same amount

(17)

LRA-Formulae

[Audemard et al., CADE’02]; [Sorea, MTCS’02]; [Niebert et al.,FTRTFT’02]

LRA-formulaeare Boolean combinations of Boolean variables and

linear constraints over real variables (equalities and differences) e.g.,(x − 2 · y ≥ 4) ∧ ((x = y ) ∨ ¬A)

Aninterpretation I for a LRA formula assigns truth values to Boolean variables

real values to numerical variables and constants e.g.,I(x) = 3, I(y ) = −1, I(A) = ⊥

I satisfiesa LRA-formula φ, written “I |= φ”, iff

I(φ) evaluates to true under the standard semantics of Boolean and mathematical operators.

E.g.,I((x − 2 · y ≥ 4) ∧ ((x = y ) ∨ ¬A)) = >

(18)

The M

ATH

SAT Solver

[Audemard et al., CADE’02]

Bottom level:a T -Solver for sets of LRA constraints

E.g. {..., z1− x1≤ 6, z2− x2≥ 8, x1=x2,z1=z2, ...}=⇒unsat.

Combination of symbolic and numerical algorithms (equivalence class building, Belman-Ford, Simplex) Top level: a CDCL procedure for propositional satisfiability

mathematical predicates treated as propositional atoms invokes T -Solver on every assignment found

used as an enumerator of assignments lots of enhancements

(see chapter on SMT)

(19)

Outline

1 Motivations & Context

2 Background

3 SMT-Based Bounded Model Checking of Timed Systems Basic Ideas

Basic Encoding

Improved & Extended Encoding A Case-Study

4 Exercises

(20)

Outline

1 Motivations & Context

2 Background

3 SMT-Based Bounded Model Checking of Timed Systems Basic Ideas

Basic Encoding

Improved & Extended Encoding A Case-Study

4 Exercises

(21)

SMT-Based BMC for Timed Systems

Independently developed approaches (2002):

[Audemard et al. FORTE’02]: encoding into LRA all LTL properties

[Sorea, MTCS’02]: encoding into LRA

based on automata-theoretic approach for LTL [Niebert et al.,FTRTFT’02]: encoding into DL

limited to reachability

Disclaimer

These slides are adapted from[Audemard et al. FORTE’02]: G. Audemard, A. Cimatti, A. Kornilowicz, R. Sebastiani Bounded Model Checking for Timed Systems,

proc. FORTE 2002, Springer

(22)

SMT-Based BMC for Timed Systems

Independently developed approaches (2002):

[Audemard et al. FORTE’02]: encoding into LRA all LTL properties

[Sorea, MTCS’02]: encoding into LRA

based on automata-theoretic approach for LTL [Niebert et al.,FTRTFT’02]: encoding into DL

limited to reachability

Disclaimer

These slides are adapted from[Audemard et al. FORTE’02]: G. Audemard, A. Cimatti, A. Kornilowicz, R. Sebastiani Bounded Model Checking for Timed Systems,

proc. FORTE 2002, Springer

freely available as http://eprints.biblio.unitn.it/124/

(23)

BMC for Timed Systems

Basic ingredients:

An extension of propositional logic expressive enough to represent timed information: “LRA-formulae”

ASMT(LRA) solverfor deciding LRA-formulae

=⇒e.g., theMATHSATsolver

Anencodingfrom timed BMC problems into LRA-formulae LRA-satisfiable iff an execution path within the bound exists

(24)

BMC for Timed Systems

Basic ingredients:

An extension of propositional logic expressive enough to represent timed information: “LRA-formulae”

ASMT(LRA) solverfor deciding LRA-formulae

=⇒e.g., theMATHSATsolver

Anencodingfrom timed BMC problems into LRA-formulae LRA-satisfiable iff an execution path within the bound exists

(25)

BMC for Timed Systems

Basic ingredients:

An extension of propositional logic expressive enough to represent timed information: “LRA-formulae”

ASMT(LRA) solverfor deciding LRA-formulae

=⇒e.g., theMATHSATsolver

Anencodingfrom timed BMC problems into LRA-formulae LRA-satisfiable iff an execution path within the bound exists

(26)

Outline

1 Motivations & Context

2 Background

3 SMT-Based Bounded Model Checking of Timed Systems Basic Ideas

Basic Encoding

Improved & Extended Encoding A Case-Study

4 Exercises

(27)

The encoding

Given atimed automaton Aand aLTL formula f:

The encoding [[A, f ]]k is obtained following the same schema as in propositional BMC:

[[A, f ]]k :=I(s(0)) ∧

k −1

^

i=0

R(s(i),s(i+1)) ∧ (¬Lk∧ [[f ]]0k) ∨

k

_

l=0

(lLkl[[f ]]0k)

[[M, f ]]k is a LRA-formula, where

Boolean variables encode thediscrete partof the state of the automaton

constraints on real variables represent thetemporal partof the state

(28)

Encoding: Boolean Variables

Locations:an arraylof ndef= dlog2(|L|)e Boolean variables li holds iff the system is in the location li

ex: “¬li[3] ∧ li[2] ∧ ¬li[1] ∧ li[0]” means “the system is in location l3

“(li =lj)” stands for “V

n(li[n] ↔ lj[n])”,

“primed” variables li0 to represent location after transition Events: for each event a ∈ Σ, a Boolean variablea

a holds iff the system executes a switch with event a.

Switches: for each switch hli,a, ϕ, λ, lji ∈ E, a Boolean variableT,

T holds iff the system executes the corresponding switch Time elapse and null transitions: two variablesTδ andTnullj

Tδ holds iff time elapses by some δ > 0

Tnullj holds if and only Aj does nothing (specific for automaton Aj) Note: also for events, switches&transitions it is possible to use arrays of Boolean variables of size dlog (|Σ|)e, dlog (|E | + 2)e respectively

(29)

Encoding: Boolean Variables

Locations:an arraylof ndef= dlog2(|L|)e Boolean variables li holds iff the system is in the location li

ex: “¬li[3] ∧ li[2] ∧ ¬li[1] ∧ li[0]” means “the system is in location l3

“(li =lj)” stands for “V

n(li[n] ↔ lj[n])”,

“primed” variables li0 to represent location after transition Events: for each event a ∈ Σ, a Boolean variablea

a holds iff the system executes a switch with event a.

Switches: for each switch hli,a, ϕ, λ, lji ∈ E, a Boolean variableT,

T holds iff the system executes the corresponding switch Time elapse and null transitions: two variablesTδ andTnullj

Tδ holds iff time elapses by some δ > 0

Tnullj holds if and only Aj does nothing (specific for automaton Aj)

(30)

Encoding: Boolean Variables

Locations:an arraylof ndef= dlog2(|L|)e Boolean variables li holds iff the system is in the location li

ex: “¬li[3] ∧ li[2] ∧ ¬li[1] ∧ li[0]” means “the system is in location l3

“(li =lj)” stands for “V

n(li[n] ↔ lj[n])”,

“primed” variables li0 to represent location after transition Events: for each event a ∈ Σ, a Boolean variablea

a holds iff the system executes a switch with event a.

Switches: for each switch hli,a, ϕ, λ, lji ∈ E, a Boolean variableT,

T holds iff the system executes the corresponding switch Time elapse and null transitions: two variablesTδ andTnullj

Tδ holds iff time elapses by some δ > 0

Tnullj holds if and only Aj does nothing (specific for automaton Aj) Note: also for events, switches&transitions it is possible to use arrays of Boolean variables of size dlog (|Σ|)e, dlog (|E | + 2)e respectively

(31)

Encoding: Boolean Variables

Locations:an arraylof ndef= dlog2(|L|)e Boolean variables li holds iff the system is in the location li

ex: “¬li[3] ∧ li[2] ∧ ¬li[1] ∧ li[0]” means “the system is in location l3

“(li =lj)” stands for “V

n(li[n] ↔ lj[n])”,

“primed” variables li0 to represent location after transition Events: for each event a ∈ Σ, a Boolean variablea

a holds iff the system executes a switch with event a.

Switches: for each switch hli,a, ϕ, λ, lji ∈ E, a Boolean variableT,

T holds iff the system executes the corresponding switch Time elapse and null transitions: two variablesTδ andTnullj

Tδ holds iff time elapses by some δ > 0

Tnullj holds if and only Aj does nothing (specific for automaton Aj)

(32)

Encoding: Boolean Variables

Locations:an arraylof ndef= dlog2(|L|)e Boolean variables li holds iff the system is in the location li

ex: “¬li[3] ∧ li[2] ∧ ¬li[1] ∧ li[0]” means “the system is in location l3

“(li =lj)” stands for “V

n(li[n] ↔ lj[n])”,

“primed” variables li0 to represent location after transition Events: for each event a ∈ Σ, a Boolean variablea

a holds iff the system executes a switch with event a.

Switches: for each switch hli,a, ϕ, λ, lji ∈ E, a Boolean variableT,

T holds iff the system executes the corresponding switch Time elapse and null transitions: two variablesTδ andTnullj

Tδ holds iff time elapses by some δ > 0

Tnullj holds if and only Aj does nothing (specific for automaton Aj) Note: also for events, switches&transitions it is possible to use arrays of Boolean variables of size dlog (|Σ|)e, dlog (|E | + 2)e respectively

(33)

Encoding: Clock Values and Constraints

Clocks valuesx are “normalized” wrt absolute time(x − z):

a clock value is written as difference x − z z represents (the negation of)the absolute time

“offset” variable x represents (the negation of)the absolute time when the clock was reset

Clock constraintsreduce to(x − z ./ c), ./ ∈ {≤, ≥, <, >}, c ∈ Z Clock reset conditionsreduce to(x := z)

Clock equalities like(xk =xl)reduce to(xk− zk =xl− zl) appear only in loops

only place where full LRA is needed (rather than DL)

=⇒ for invariant checking (no loops) DL suffices Encoding theeffect of transitions:

with a time elapse transition z0<z, andx0=x otherwise:

(34)

Encoding: Clock Values and Constraints

Clocks valuesx are “normalized” wrt absolute time(x − z):

a clock value is written as difference x − z z represents (the negation of)the absolute time

“offset” variable x represents (the negation of)the absolute time when the clock was reset

Clock constraintsreduce to(x − z ./ c), ./ ∈ {≤, ≥, <, >}, c ∈ Z Clock reset conditionsreduce to(x := z)

Clock equalities like(xk =xl)reduce to(xk− zk =xl− zl) appear only in loops

only place where full LRA is needed (rather than DL)

=⇒ for invariant checking (no loops) DL suffices Encoding theeffect of transitions:

with a time elapse transition z0<z, andx0=x otherwise:

z0=z, absolute time does not elapse x0=z0, if the clock is reset

(35)

Encoding: Clock Values and Constraints

Clocks valuesx are “normalized” wrt absolute time(x − z):

a clock value is written as difference x − z z represents (the negation of)the absolute time

“offset” variable x represents (the negation of)the absolute time when the clock was reset

Clock constraintsreduce to(x − z ./ c), ./ ∈ {≤, ≥, <, >}, c ∈ Z Clock reset conditionsreduce to(x := z)

Clock equalities like(xk =xl)reduce to(xk− zk =xl− zl) appear only in loops

only place where full LRA is needed (rather than DL)

=⇒ for invariant checking (no loops) DL suffices Encoding theeffect of transitions:

with a time elapse transition z0<z, andx0=x otherwise:

(36)

Encoding: Clock Values and Constraints

Clocks valuesx are “normalized” wrt absolute time(x − z):

a clock value is written as difference x − z z represents (the negation of)the absolute time

“offset” variable x represents (the negation of)the absolute time when the clock was reset

Clock constraintsreduce to(x − z ./ c), ./ ∈ {≤, ≥, <, >}, c ∈ Z Clock reset conditionsreduce to(x := z)

Clock equalities like(xk =xl)reduce to(xk− zk =xl− zl) appear only in loops

only place where full LRA is needed (rather than DL)

=⇒ for invariant checking (no loops) DL suffices Encoding theeffect of transitions:

with a time elapse transition z0<z, andx0=x otherwise:

z0=z, absolute time does not elapse x0=z0, if the clock is reset

(37)

Encoding: Clock Values and Constraints

Clocks valuesx are “normalized” wrt absolute time(x − z):

a clock value is written as difference x − z z represents (the negation of)the absolute time

“offset” variable x represents (the negation of)the absolute time when the clock was reset

Clock constraintsreduce to(x − z ./ c), ./ ∈ {≤, ≥, <, >}, c ∈ Z Clock reset conditionsreduce to(x := z)

Clock equalities like(xk =xl)reduce to(xk− zk =xl− zl) appear only in loops

only place where full LRA is needed (rather than DL)

=⇒ for invariant checking (no loops) DL suffices Encoding theeffect of transitions:

with a time elapse transition z0<z, andx0=x otherwise:

(38)

Encoding: Clock Values and Constraints

Clocks valuesx are “normalized” wrt absolute time(x − z):

a clock value is written as difference x − z z represents (the negation of)the absolute time

“offset” variable x represents (the negation of)the absolute time when the clock was reset

Clock constraintsreduce to(x − z ./ c), ./ ∈ {≤, ≥, <, >}, c ∈ Z Clock reset conditionsreduce to(x := z)

Clock equalities like(xk =xl)reduce to(xk− zk =xl− zl) appear only in loops

only place where full LRA is needed (rather than DL)

=⇒ for invariant checking (no loops) DL suffices Encoding theeffect of transitions:

with a time elapse transition z0<z, andx0=x otherwise:

z0=z, absolute time does not elapse x0=z0, if the clock is reset

(39)

Encoding: Clock Values and Constraints

Clocks valuesx are “normalized” wrt absolute time(x − z):

a clock value is written as difference x − z z represents (the negation of)the absolute time

“offset” variable x represents (the negation of)the absolute time when the clock was reset

Clock constraintsreduce to(x − z ./ c), ./ ∈ {≤, ≥, <, >}, c ∈ Z Clock reset conditionsreduce to(x := z)

Clock equalities like(xk =xl)reduce to(xk− zk =xl− zl) appear only in loops

only place where full LRA is needed (rather than DL)

=⇒ for invariant checking (no loops) DL suffices Encoding theeffect of transitions:

with a time elapse transition z0<z, andx0=x otherwise:

(40)

Encoding: Clock Values and Constraints

Clocks valuesx are “normalized” wrt absolute time(x − z):

a clock value is written as difference x − z z represents (the negation of)the absolute time

“offset” variable x represents (the negation of)the absolute time when the clock was reset

Clock constraintsreduce to(x − z ./ c), ./ ∈ {≤, ≥, <, >}, c ∈ Z Clock reset conditionsreduce to(x := z)

Clock equalities like(xk =xl)reduce to(xk− zk =xl− zl) appear only in loops

only place where full LRA is needed (rather than DL)

=⇒ for invariant checking (no loops) DL suffices Encoding theeffect of transitions:

with a time elapse transition z0<z, andx0=x otherwise:

z0=z, absolute time does not elapse x0=z0, if the clock is reset

(41)

Encoding: Clock Values and Constraints

Clocks valuesx are “normalized” wrt absolute time(x − z):

a clock value is written as difference x − z z represents (the negation of)the absolute time

“offset” variable x represents (the negation of)the absolute time when the clock was reset

Clock constraintsreduce to(x − z ./ c), ./ ∈ {≤, ≥, <, >}, c ∈ Z Clock reset conditionsreduce to(x := z)

Clock equalities like(xk =xl)reduce to(xk− zk =xl− zl) appear only in loops

only place where full LRA is needed (rather than DL)

=⇒ for invariant checking (no loops) DL suffices Encoding theeffect of transitions:

with a time elapse transition z0<z, andx0=x otherwise:

(42)

Encoding: Initial Conditions

Initial condition I(s):

Initially, the automaton is in an initial location:

_

li∈L0

li

Initially, clocks have a null value:

^

x ∈X

(x = z)

(43)

Encoding: Initial Conditions

Initial condition I(s):

Initially, the automaton is in an initial location:

_

li∈L0

li

Initially, clocks have a null value:

^

x ∈X

(x = z)

(44)

Encoding: Initial Conditions

Initial condition I(s):

Initially, the automaton is in an initial location:

_

li∈L0

li

Initially, clocks have a null value:

^

x ∈X

(x = z)

(45)

Encoding: Invariants

Transition relation R(s, s0): Invariants

Always, being in a location implies the corresponding

constraints: ^

li∈L

(li → ^

ψ∈I(li)

ψ),

(46)

Encoding: Transitions

Transition relation T (s, s0):

Switches:

^

Tdef= hli,a,ϕ,λ,lji∈E

T →

li∧ a ∧ ϕ ∧ lj0∧ ^

x ∈λ

(x0 =z0) ∧ ^

x 6∈λ

(x0=x ) ∧ (z0=z)

Time elapse:

Tδ→ (z0− z < 0) ∧ (l0 =l) ∧ ^

x ∈X

(x0 =x ) ∧ ^

a∈Σ

¬a

!

Null transition:

Tnullj → (z0 =z) ∧ (l0 =l) ∧ ^

x ∈X

(x0 =x ) ∧ ^

a∈Σ

¬a

!

(47)

Encoding: Transitions

Transition relation T (s, s0):

Switches:

^

Tdef= hli,a,ϕ,λ,lji∈E

T →

li∧ a ∧ ϕ ∧ lj0∧ ^

x ∈λ

(x0 =z0) ∧ ^

x 6∈λ

(x0=x ) ∧ (z0=z)

Time elapse:

Tδ→ (z0− z < 0) ∧ (l0 =l) ∧ ^

x ∈X

(x0 =x ) ∧ ^

a∈Σ

¬a

!

Null transition:

Tnullj → (z0 =z) ∧ (l0 =l) ∧ ^

(x0 =x ) ∧ ^

¬a

!

(48)

Encoding: Transitions

Transition relation T (s, s0):

Switches:

^

Tdef= hli,a,ϕ,λ,lji∈E

T →

li∧ a ∧ ϕ ∧ lj0∧ ^

x ∈λ

(x0 =z0) ∧ ^

x 6∈λ

(x0=x ) ∧ (z0=z)

Time elapse:

Tδ→ (z0− z < 0) ∧ (l0 =l) ∧ ^

x ∈X

(x0 =x ) ∧ ^

a∈Σ

¬a

!

Null transition:

Tnullj → (z0 =z) ∧ (l0 =l) ∧ ^

x ∈X

(x0 =x ) ∧ ^

a∈Σ

¬a

!

(49)

Encoding: Transitions

Transition relation T (s, s0):

Switches:

^

Tdef= hli,a,ϕ,λ,lji∈E

T →

li∧ a ∧ ϕ ∧ lj0∧ ^

x ∈λ

(x0 =z0) ∧ ^

x 6∈λ

(x0=x ) ∧ (z0=z)

Time elapse:

Tδ→ (z0− z < 0) ∧ (l0 =l) ∧ ^

x ∈X

(x0 =x ) ∧ ^

a∈Σ

¬a

!

Null transition:

Tnullj → (z0 =z) ∧ (l0 =l) ∧ ^

(x0 =x ) ∧ ^

¬a

!

(50)

Encoding: Relations between Transitions

Mutual exclusion between events:

^

ak,ar∈Σ,ak6=ar

(¬ak∨ ¬ar)

At least one transition takes place:

Tnullj ∨ Tδ∨ _

T ∈E

T

Mutual exclusion between transitions:

^

Tk,Tr ∈ E∪{Tnullj }∪{Tδ},Tk6=Tr

(¬Tk∨ ¬Tr)

If events and transitions are encoded via arrays of Booleans, mutual exclusion constraints are not needed

(51)

Encoding: Relations between Transitions

Mutual exclusion between events:

^

ak,ar∈Σ,ak6=ar

(¬ak∨ ¬ar)

At least one transition takes place:

Tnullj ∨ Tδ∨ _

T ∈E

T

Mutual exclusion between transitions:

^

Tk,Tr ∈ E∪{Tnullj }∪{Tδ},Tk6=Tr

(¬Tk∨ ¬Tr)

If events and transitions are encoded via arrays of Booleans, mutual

(52)

Encoding: Relations between Transitions

Mutual exclusion between events:

^

ak,ar∈Σ,ak6=ar

(¬ak∨ ¬ar)

At least one transition takes place:

Tnullj ∨ Tδ∨ _

T ∈E

T

Mutual exclusion between transitions:

^

Tk,Tr ∈ E∪{Tnullj }∪{Tδ},Tk6=Tr

(¬Tk∨ ¬Tr)

If events and transitions are encoded via arrays of Booleans, mutual exclusion constraints are not needed

(53)

Encoding: Relations between Transitions

Mutual exclusion between events:

^

ak,ar∈Σ,ak6=ar

(¬ak∨ ¬ar)

At least one transition takes place:

Tnullj ∨ Tδ∨ _

T ∈E

T

Mutual exclusion between transitions:

^

Tk,Tr ∈ E∪{Tnullj }∪{Tδ},Tk6=Tr

(¬Tk∨ ¬Tr)

If events and transitions are encoded via arrays of Booleans, mutual

(54)

Encoding: Relations between Transitions

Mutual exclusion between events:

^

ak,ar∈Σ,ak6=ar

(¬ak∨ ¬ar)

At least one transition takes place:

Tnullj ∨ Tδ∨ _

T ∈E

T

Mutual exclusion between transitions:

^

Tk,Tr ∈ E∪{Tnullj }∪{Tδ},Tk6=Tr

(¬Tk∨ ¬Tr)

If events and transitions are encoded via arrays of Booleans, mutual exclusion constraints are not needed

(55)

Automata Product Construction

The encoding is compositional wrt. product of automata The encoding of A = A1||A2is given by theconjunction of the encodings of A1and A2, plus a few extra axioms

Mutual exclusion between events that are local

^ a1∈ Σ12 a2∈ Σ21

(¬a1∨ ¬a2)

Forcing system activity:

N−1

_

j=0

¬Tnullj

j

(56)

Automata Product Construction

The encoding is compositional wrt. product of automata The encoding of A = A1||A2is given by theconjunction of the encodings of A1and A2, plus a few extra axioms

Mutual exclusion between events that are local

^ a1∈ Σ12 a2∈ Σ21

(¬a1∨ ¬a2)

Forcing system activity:

N−1

_

j=0

¬Tnullj

one distinct Tnullj for each automaton Aj

Tδ is common to all automata Aj

(57)

Automata Product Construction

The encoding is compositional wrt. product of automata The encoding of A = A1||A2is given by theconjunction of the encodings of A1and A2, plus a few extra axioms

Mutual exclusion between events that are local

^ a1∈ Σ12 a2∈ Σ21

(¬a1∨ ¬a2)

Forcing system activity:

N−1

_

j=0

¬Tnullj

j

(58)

Automata Product Construction

The encoding is compositional wrt. product of automata The encoding of A = A1||A2is given by theconjunction of the encodings of A1and A2, plus a few extra axioms

Mutual exclusion between events that are local

^ a1∈ Σ12 a2∈ Σ21

(¬a1∨ ¬a2)

Forcing system activity:

N−1

_

j=0

¬Tnullj

one distinct Tnullj for each automaton Aj

Tδ is common to all automata Aj

(59)

A Simple Example

T12

T21 a

b

l1 l2

x:=z

x−z <= 2 x−z<=3

x−z>=1

T

T

z T 0

T F F

F 0.0

−1.0 T 1

F

F

F 0.0

−1.0 F 2

F F F T

F

−1.0

0.0 3

F F T

F −1.0

−1.0 4

0.0

0.0 STEP:

l1

x

T T T T 12 21 null δ

(60)

Outline

1 Motivations & Context

2 Background

3 SMT-Based Bounded Model Checking of Timed Systems Basic Ideas

Basic Encoding

Improved & Extended Encoding A Case-Study

4 Exercises

(61)

Encoding: Extension

Adding Global Variables

Dealing with some global variable v on discrete domain:

A switch T def= hli,a, ϕ, λ, lji can be subject to a condition ψ(v )

=⇒ addT → ψ(v )

assign v to some value n or keep its value

=⇒ addT → (v0=n)or addT → (v0=v ) Tδmantains the value of v :

=⇒ addTδ → (v0=v )

Tnullj imposes no constraint on v :

=⇒ add nothing (for Aj)

(62)

Encoding: Extension

Adding Global Variables

Dealing with some global variable v on discrete domain:

A switch T def= hli,a, ϕ, λ, lji can be subject to a condition ψ(v )

=⇒ addT → ψ(v )

assign v to some value n or keep its value

=⇒ addT → (v0=n)or addT → (v0=v ) Tδmantains the value of v :

=⇒ addTδ → (v0=v )

Tnullj imposes no constraint on v :

=⇒ add nothing (for Aj)

(63)

Encoding: Extension

Adding Global Variables

Dealing with some global variable v on discrete domain:

A switch T def= hli,a, ϕ, λ, lji can be subject to a condition ψ(v )

=⇒ addT → ψ(v )

assign v to some value n or keep its value

=⇒ addT → (v0=n)or addT → (v0=v ) Tδmantains the value of v :

=⇒ addTδ → (v0=v )

Tnullj imposes no constraint on v :

=⇒ add nothing (for Aj)

(64)

Encoding: Extension

Adding Global Variables

Dealing with some global variable v on discrete domain:

A switch T def= hli,a, ϕ, λ, lji can be subject to a condition ψ(v )

=⇒ addT → ψ(v )

assign v to some value n or keep its value

=⇒ addT → (v0=n)or addT → (v0=v ) Tδmantains the value of v :

=⇒ addTδ → (v0=v )

Tnullj imposes no constraint on v :

=⇒ add nothing (for Aj)

(65)

Encoding: Extension

Adding Global Variables

Dealing with some global variable v on discrete domain:

A switch T def= hli,a, ϕ, λ, lji can be subject to a condition ψ(v )

=⇒ addT → ψ(v )

assign v to some value n or keep its value

=⇒ addT → (v0=n)or addT → (v0=v ) Tδmantains the value of v :

=⇒ addTδ → (v0=v )

Tnullj imposes no constraint on v :

=⇒ add nothing (for Aj)

(66)

Encoding: Extension

Adding Global Variables

Dealing with some global variable v on discrete domain:

A switch T def= hli,a, ϕ, λ, lji can be subject to a condition ψ(v )

=⇒ addT → ψ(v )

assign v to some value n or keep its value

=⇒ addT → (v0=n)or addT → (v0=v ) Tδmantains the value of v :

=⇒ addTδ → (v0=v )

Tnullj imposes no constraint on v :

=⇒ add nothing (for Aj)

(67)

Encoding: Extension

Adding Global Variables

Dealing with some global variable v on discrete domain:

A switch T def= hli,a, ϕ, λ, lji can be subject to a condition ψ(v )

=⇒ addT → ψ(v )

assign v to some value n or keep its value

=⇒ addT → (v0=n)or addT → (v0=v ) Tδmantains the value of v :

=⇒ addTδ → (v0=v )

Tnullj imposes no constraint on v :

=⇒ add nothing (for Aj)

(68)

Encoding: Extension

Adding Global Variables

Dealing with some global variable v on discrete domain:

A switch T def= hli,a, ϕ, λ, lji can be subject to a condition ψ(v )

=⇒ addT → ψ(v )

assign v to some value n or keep its value

=⇒ addT → (v0=n)or addT → (v0=v ) Tδmantains the value of v :

=⇒ addTδ → (v0=v )

Tnullj imposes no constraint on v :

=⇒ add nothing (for Aj)

(69)

Encoding: Extension

Adding Global Variables

Dealing with some global variable v on discrete domain:

A switch T def= hli,a, ϕ, λ, lji can be subject to a condition ψ(v )

=⇒ addT → ψ(v )

assign v to some value n or keep its value

=⇒ addT → (v0=n)or addT → (v0=v ) Tδmantains the value of v :

=⇒ addTδ → (v0=v )

Tnullj imposes no constraint on v :

=⇒ add nothing (for Aj)

(70)

M

ATH

SAT: Optimizations

Customization of MATHSAT

Limit Boolean variable-selection heuristic to picktransition variables, in forward order

Riferimenti

Documenti correlati

Deadend states: reachable states which do not allow to proceed along a refinement of the abstract counter-example. Bad states: un-reachable states which allow to proceed along

Some exampes displayed in these slides are taken from [Clarke, Grunberg &amp; Peled, “Model Checking”, MIT Press], and their copyright is detained by the authors?. All the

for a restricted number of students, in turn, it will be possible to follow the class physically in the classroom following the safety access protocols. for everybody else it will

If a student willingly refuses to comply to the rules (e.g., to wear a mask) the teacher is supposed to take his/her data and to call the DISI COVID19-safety responsible, who

=⇒ Substantially, add one initial state, move labels from states to incoming edges, set fair states as accepting states.. The Main Problem of M.C.: State

=⇒ It is reasonable enough to assume the protocol suitable under the condition that each user is infinitely often outside the restroom.. Such a condition is called

Various techniques: Bounded Model Checking (BMC), K-induction, Interpolant-based, IC3/PDR,..... SAT-based Bounded Model Checking

satisfiability of the Boolean formulas is checked by a SAT solver can manage complex formulae on several 100K variables returns satisfying assignment (i.e., a counter-example)