University of Texas at Dallas Neda Saeedloei Gopal

  • Slides: 23
Download presentation
University of Texas at Dallas Neda Saeedloei, Gopal Gupta Verifying Complex Continuous Real. Time

University of Texas at Dallas Neda Saeedloei, Gopal Gupta Verifying Complex Continuous Real. Time Systems with Coinductive CLP(R) Neda Saeedloei, Gopal Gupta Department of Computer Science The University of Texas at Dallas Richardson, Texas, USA CICLOPS 2009 July 14 th 2009 Advanced Logic Programming-Languages and Systems (ALPS) Lab @ UTD Slide- 1

University of Texas at Dallas Neda Saeedloei, Gopal Gupta Real-Time Systems • Timed automata

University of Texas at Dallas Neda Saeedloei, Gopal Gupta Real-Time Systems • Timed automata for specifying real-time systems – Recognize only timed regular languages • Pushdown timed automata – Recognize timed context-free languages Advanced Logic Programming-Languages and Systems (ALPS) Lab @ UTD Slide- 2

University of Texas at Dallas Neda Saeedloei, Gopal Gupta Motivation • constraint logic programming

University of Texas at Dallas Neda Saeedloei, Gopal Gupta Motivation • constraint logic programming over reals or CLP(R) & Co-induction for modeling timed automata • Modeling PTAs with Co-induction and CLP(R) • verify safety and liveness properties • The Generalized Railroad Crossing problem – Safety – Utility Advanced Logic Programming-Languages and Systems (ALPS) Lab @ UTD Slide- 3

University of Texas at Dallas Neda Saeedloei, Gopal Gupta ω-Automata • ω-automata over the

University of Texas at Dallas Neda Saeedloei, Gopal Gupta ω-Automata • ω-automata over the alphabet Σ is a tuple M= < Σ, Δ, Q, Q 0, F > – – Q is the (finite) set of states Q 0 ⊆ Q is the set of initial states F ⊆ Q is the set of final states Δ ⊆ Q x Σ x Q is the transition relation • Given an infinite string s = s 0 s 1 s 2… , where si Є Σ, a derivation is defined as a sequence of transitions • q 0 Є Q 0 , and (qi-1, si-1, qi) Є Δ • Notions of acceptance of an infinite string s = s 0 s 1 s 2… – Bϋchi: ∃q Є F and an infinite set of indices I such that (∀iЄ I)(q = qi). – Mϋller: F Є 2 Q, ∃A Є F, and an infinite set of indices Ia for each a Є A such that (∀q Є A) (∀iЄ Ia)(q = qi). Advanced Logic Programming-Languages and Systems (ALPS) Lab @ UTD Slide- 4

University of Texas at Dallas Neda Saeedloei, Gopal Gupta Timed-Automata • A generalization of

University of Texas at Dallas Neda Saeedloei, Gopal Gupta Timed-Automata • A generalization of ω-automata, capable of recognizing infinite words • Given a string s = s 0 s 1 s 2…, Purpose of timed automata is accepting timed words (si, ti) • Timed automata obtained from ω-automata by adding – – a finite set C of clocks a set P of propositions over C a labeling function τc : Δ → 2 C (reset function) a labeling function τP : Δ → Prop(P), where prop(A) is the set of propositional formulae over the set of atomic propositions A Advanced Logic Programming-Languages and Systems (ALPS) Lab @ UTD Slide- 5

University of Texas at Dallas Neda Saeedloei, Gopal Gupta Pushdown Timed Automata • A

University of Texas at Dallas Neda Saeedloei, Gopal Gupta Pushdown Timed Automata • A Pushdown Timed Automaton extends a timed automaton with a stack • A PTA is obtained from a timed automaton by adding – ε (empty string) to the input alphabet Σ – a stack alphabet Γε = Γ U ε – a stack represented by Γε * • Acceptance conditions for an infinite string for a PTA – the stack must be empty. Advanced Logic Programming-Languages and Systems (ALPS) Lab @ UTD Slide- 6

University of Texas at Dallas Neda Saeedloei, Gopal Gupta Pushdown Timed Automata Example S

University of Texas at Dallas Neda Saeedloei, Gopal Gupta Pushdown Timed Automata Example S R T T RS a {c : = 0} T b {c < 20} a. Tb a b {c < 5} Advanced Logic Programming-Languages and Systems (ALPS) Lab @ UTD Slide- 7

University of Texas at Dallas Neda Saeedloei, Gopal Gupta Recognizers for ω-PDAs and ωGrammars.

University of Texas at Dallas Neda Saeedloei, Gopal Gupta Recognizers for ω-PDAs and ωGrammars. • PTAs and timed grammars accept infinite strings. • Definite clause grammars (DCGs) extended with co-induction can act as recognizers for ω -PDAs and ω-grammars. – Using DCG facility of prolog to create parser for context-free grammars or even context-sensitive grammars. – extending logic programming with co-induction, to develop language processors that recognize infinite strings. Advanced Logic Programming-Languages and Systems (ALPS) Lab @ UTD Slide- 8

University of Texas at Dallas Neda Saeedloei, Gopal Gupta Modeling PTAs with coinductive CLP(R)

University of Texas at Dallas Neda Saeedloei, Gopal Gupta Modeling PTAs with coinductive CLP(R) trans(s 0, a, s 1, T, Tr, To, _, [1]) : - {To=T}. trans(s 1, a, s 1, T, Tr, To, C, [1|C]): - {To=Tr}. trans(s 1, b, s 2, T, Tr, To, [1|C], C): - {T - Tr < 5, To =Tr}. trans(s 2, b, s 2, T, Tr, To, [1|C], C): - {To=Tr}. trans(s 2, b, s 0, T, Tr, To, [1|C], C): - {T - Tr < 20, To =Tr}. : -coinductive(driver/6). driver([X| R], Si, C 1, Tr, T, [(X, T)| S]) : trans(Si, X, Sj, T, Tr, To, C 1, C 2), {Ta > T}, driver(R, Sj, C 2, To, Ta, S). Advanced Logic Programming-Languages and Systems (ALPS) Lab @ UTD Slide- 9

University of Texas at Dallas Neda Saeedloei, Gopal Gupta The Generalized Railroad Crossing •

University of Texas at Dallas Neda Saeedloei, Gopal Gupta The Generalized Railroad Crossing • Railroad crossing I lies in a region of interest R, i. e. , I ⊆ R. • A set of trains travel through R on multiple tracks in both directions. • A sensor system determines when each train enters and exits region R. • gate function g(t) Є [0, 90], – g(t) = 0 means the gate is down – g(t) = 90 means the gate is up. • • occupancy intervals: {λi} The ith occupancy interval: λi = [τi , νi] Safety Property: t Є Ui λi →g(t) = 0 Utility Property: t ∉ Ui[τi – ξ 1, νi + ξ 2] → g(t) = 90 Advanced Logic Programming-Languages and Systems (ALPS) Lab @ UTD Slide- 10

University of Texas at Dallas Neda Saeedloei, Gopal Gupta The GRC Problem • ε

University of Texas at Dallas Neda Saeedloei, Gopal Gupta The GRC Problem • ε 1, a lower bound on the time from when a train enters R until it reaches I. • ε 2, an upper bound on the time from when a train enters R until it reaches I. • γdown, an upper bound on the time to lower the gate completely. • γup, an upper bound on the time to raise the gate completely. • ξ 1, an upper bound on the time from the start of lowering the gate until some train is in I. • ξ 2, an upper bound on the time from when the last train leaves I until the gate is up. Advanced Logic Programming-Languages and Systems (ALPS) Lab @ UTD Slide- 11

University of Texas at Dallas Neda Saeedloei, Gopal Gupta GRC Problem • 1 -Track

University of Texas at Dallas Neda Saeedloei, Gopal Gupta GRC Problem • 1 -Track Generalized Railroad Crossing Problem – One track, unspecified number of trains • GRC Problem – Arbitrary number of tracks, unspecified number of trains Advanced Logic Programming-Languages and Systems (ALPS) Lab @ UTD Slide- 12

University of Texas at Dallas Neda Saeedloei, Gopal Gupta Track Automaton Advanced Logic Programming-Languages

University of Texas at Dallas Neda Saeedloei, Gopal Gupta Track Automaton Advanced Logic Programming-Languages and Systems (ALPS) Lab @ UTD Slide- 13

University of Texas at Dallas Neda Saeedloei, Gopal Gupta Gate Automaton Advanced Logic Programming-Languages

University of Texas at Dallas Neda Saeedloei, Gopal Gupta Gate Automaton Advanced Logic Programming-Languages and Systems (ALPS) Lab @ UTD Slide- 14

University of Texas at Dallas Neda Saeedloei, Gopal Gupta Controller Automaton Advanced Logic Programming-Languages

University of Texas at Dallas Neda Saeedloei, Gopal Gupta Controller Automaton Advanced Logic Programming-Languages and Systems (ALPS) Lab @ UTD Slide- 15

University of Texas at Dallas Neda Saeedloei, Gopal Gupta Track Automata • ε 1

University of Texas at Dallas Neda Saeedloei, Gopal Gupta Track Automata • ε 1 = 2, ε 2 = 3, γdown = 1, γup = 2, ξ 1 = 2, ξ 2 = 3 track(s 0, approach, s 1, GT, TI, TO, L) : - {TO = GT}. track(s 1, in, s 2, GT, TI, TO, L) : - {GT - TI > 2, GT - TI < 3, TO = TI}. track(s 2, approach, s 3, GT, TI, TO, L) : - {TO = GT}. track(s 4, in, s 2, GT, TI, TO, L) : - {GT - TI > 2, GT - TI < 3, TO = TI}. track(s 3, exit, s 4, GT, TI, TO, L) : first(L, First), {GT - First < 5, TO = TI}. track(s 2, exit, s 0, GT, TI, TO, L) : first(L, First), {GT - First < 5, TO = TI}. track(X, lower, X, GT, TI, L). track(X, down, X, GT, TI, L). track(X, up, X, GT, TI, L). track(X, raise, X, GT, TI, L). Advanced Logic Programming-Languages and Systems (ALPS) Lab @ UTD Slide- 16

University of Texas at Dallas Neda Saeedloei, Gopal Gupta Gate Automaton gate(s 0, lower,

University of Texas at Dallas Neda Saeedloei, Gopal Gupta Gate Automaton gate(s 0, lower, s 1, GT, TI, TO) : - {TO = GT}. gate(s 1, down , s 2, GT, TI, TO) : {TO = TI, GT - TI < 1}. gate(s 2, raise, s 3, GT, TI, TO) : - {TO = GT}. gate(s 3, up, s 0, GT, TI, TO) : {TO = TI, GT - TI < 2}. gate(X, approach, X, GT, TI). gate(X, in, X, GT, TI). gate(X, exit, X, GT, TI). Advanced Logic Programming-Languages and Systems (ALPS) Lab @ UTD Slide- 17

University of Texas at Dallas Neda Saeedloei, Gopal Gupta Controller Automaton contr(s 0, approach,

University of Texas at Dallas Neda Saeedloei, Gopal Gupta Controller Automaton contr(s 0, approach, C 1, C 2, s 1, GT, TI, TO) : - C 2 is C 1 + 1, {TO = GT}. contr(s 1, lower, C 1, s 2, GT, TI, TO) : - {GT - TI = 1, TO = TI}. contr(s 2, approach, C 1, C 2, s 2, GT, TI, TO) : - C 2 is C 1 + 1, {TO = TI}. contr(s 3, raise, C 1, s 0, GT, TI, TO) : - {GT - TI < 1, TO = TI}. contr(s 2, exit, C 1, C 2, s 3, GT, TI, TO): - C 1 = 1, C 2 is C 1 - 1, {TO = GT}. contr(s 2, exit, C 1, C 2, s 2, GT, TI, TO): - C 1 > 1, C 2 is C 1 - 1, {TO = TI}. contr(s 2, in, C 1, s 2, GT, TI). contr(s 0, up, C 1, s 0, GT, TI). contr(s 2, down, C 1, s 2, GT, TI). Advanced Logic Programming-Languages and Systems (ALPS) Lab @ UTD Slide- 18

University of Texas at Dallas Neda Saeedloei, Gopal Gupta The driver predicate • The

University of Texas at Dallas Neda Saeedloei, Gopal Gupta The driver predicate • The driver predicate composes three automata driver(C 1, ST, SC, SG, GT, CC, CG, [X|Rest], Resets, [(X, GT)|R]) : track(ST, X, STO, GT, CTO, Resets), contr(C 1, SC, X, C 2, SCO, GT, CCO), gate(SG, X, SGO, GT, CGO), {TA > GT}, (X = approach -> add-to-list(GT, Resets, New. Resets); (X = exit -> delete-first(Resets, New. Resets); New. Resets = Resets)), driver(C 2, STO, SCO, SGO, TA, CTO, CCO, CGO, Rest, New. Resets, R ). Advanced Logic Programming-Languages and Systems (ALPS) Lab @ UTD Slide- 19

University of Texas at Dallas Neda Saeedloei, Gopal Gupta Safety and Utility Properties •

University of Texas at Dallas Neda Saeedloei, Gopal Gupta Safety and Utility Properties • firstinbeforedown(X) : - driver(0, s 0, 0, 0, X, [], R), append(B, [(in, _) | _], R), append([(approach, 0)], A, B), +member(down, A). • inbeforedown(X) : - driver(0, s 0, 0, 0, X, [], R), append(C, [(in, _) | _], R), append(A, B, C), append(_, [(up, _)], A), +member((down, _), B). • utility(X) : - driver(0, s 0, 0, 0, X, [], R), append(A, B, R), member([(down, _)], A), +member((in, _), B). Advanced Logic Programming-Languages and Systems (ALPS) Lab @ UTD Slide- 20

University of Texas at Dallas Neda Saeedloei, Gopal Gupta The GRC Problem • contr(C

University of Texas at Dallas Neda Saeedloei, Gopal Gupta The GRC Problem • contr(C 1, s 1, approach, C 2, s 1, GT, TI, TO): C 2 is C 1 + 1, {TO = TI}. Advanced Logic Programming-Languages and Systems (ALPS) Lab @ UTD Slide- 21

University of Texas at Dallas Neda Saeedloei, Gopal Gupta The driver predicate for GRC

University of Texas at Dallas Neda Saeedloei, Gopal Gupta The driver predicate for GRC problem driver(C 1, No. Tracks, SC, SG, GT, CC, CG, [X|Rest], Tracks, Trk. Resets, Trains, [(X, Track, GT)|R]): contr(C 1, SC, X, C 2, SCO, GT, CCO), gate(SG, X, SGO, GT, CGO), {TA > GT}, ((X = approach, N is No. Tracks + 1, random(1, N, Track); (X=in; X=exit), member(Track, Trains))-> nth. Element(Track, Tracks, Trk), arg(1, Trk, CT), arg(2, Trk, ST), nth. Element(Track, Trk. Resets, Trk. Reset), train(Track, ST, X, STO, GT, CTO, Trk. Reset), update(Track, Tracks, (CTO, STO), New. Tracks), (X = approach -> add-to-list(GT, Trk. Reset, New. Trk), update(Track, Trk. Resets, New. Trk. Resets), add-to-list(Track, Trains, New. Trains); (X = exit -> delete-first(Trk. Reset, New. Trk), update(Track, Trk. Resets, New. Trk. Resets), delete-first(Track, Trains, New. Trains); New. Trk. Resets = Trk. Resets, New. Trains = Trains)); New. Trk. Resets = Trk. Resets, New. Trains = Trains, New. Tracks = Tracks), driver(C 2, No. Tracks, SCO, SGO, TA, CCO, CGO, Rest, New. Tracks, New. Trk. Resets, New. Trains, R). Advanced Logic Programming-Languages and Systems (ALPS) Lab @ UTD Slide- 22

University of Texas at Dallas Neda Saeedloei, Gopal Gupta Conclusions • Automata based real-time

University of Texas at Dallas Neda Saeedloei, Gopal Gupta Conclusions • Automata based real-time formalisms – – Timed automata Timed transition systems Discrete pushdown timed automata Pushdown timed automata with dense clocks • Solutions for GRC problem – A solution based on ESTEREL programming language • Time is discretized • The number of trains is chosen at compile time • Verifying safety properties is extremely complex – UPPAAL • Based on timed automata formalism Advanced Logic Programming-Languages and Systems (ALPS) Lab @ UTD Slide- 23