SlideShare une entreprise Scribd logo
1  sur  4
Télécharger pour lire hors ligne
CTL Model Checking in Database Cloud
                                                         German Shegalov
                                                         Oracle Corp.
                                      500 Oracle Parkway, Redwood Shores, CA 94065, USA
                                                 german.shegalov@oracle.com


Abstract— Modern software systems such as OS, RDBMS, JVM,            rated virtual machine that will close the gap for any Tur-
etc have reached enormous complexity by any metric ranging           ing-computable problem. The task of a model checker is to
from the number of lines of code to the program state explosion      verify whether the system under test satisfies a property posed
due to concurrency. Standard quality assurance methods do not        as a formulae in temporal logics such as CTL.
yield strong correctness guarantees because even 100% code cov-
erage – while a desirable metric – is not equivalent to the                                 II. CTL BACKGROUND
state/execution path coverage. Whereas model checking provides
rigor correctness proofs, its computational complexity is often          Model checking is a formal method of software/hardware
prohibitive for real world systems. With advances of distributed     verification – an automated way of providing mathematical
computing frameworks such as MapReduce, and affordability of         proofs [1]. In this paper, we deal with the Computational Tree
large computer clusters (e.g., offered as an on-demand Cloud ser-    Logic (CTL) [3] model checking.
vice), steadily larger systems can be verified using model check-        Along with the traditional Boolean operators, CTL defines
ing. In this paper, we envision database vendors compete for         the existential path quantifier E and the universal path quanti-
achieving the highest possible degree of verification using
                                                                     fier A for the paths originating in some state s. Temporal as-
massive scalability features. To this end, we show a way of imple-
menting a CTL model checker as an SQL application that a data-       pects are expressed using the unary modalities neXt (refers to
base system will “tune” for the cloud.                               successor state), Globally (all reachable states satisfy the for-
                                                                     mula), Finally (a reachable state satisfies the formula), and the
                         I. INTRODUCTION                             binary modality Until (the left-hand formula is valid at least
   In this paper, we demonstrate a relatively simple way to          until a state is reached where the right-hand formula holds).
turn a relational database system in a powerful verification         The unary modalities are usually most relevant in the praxis.
tool. We show only a very basic technique of implementing a              The set of CTL formulae over a finite set of atomic propos-
model checker inside a database system. The idea is to en-           itions P, denoted as CTL(P), is formally defined as follows us-
courage database vendors to compete not only on perform-             ing the structural induction:
ance-oriented benchmark but on merits of objective software              p ∈ P implies p ∈ CTL(P)
quality as well. An interesting side effect of this is that the          {p, q} ⊆ CTL(P) implies {¬p, p ∧ q, EX p, E (p U q), A (p
database system will be able to verify its own concurrency           U q)} ⊆ CTL(P)
control and recovery protocols.                                          Given basic formulae defined above, the following short-
   Several steps are required on the way towards software            hand syntax is provided as equivalent to formulae in the basic
verification. First the source code has to be converted into         set:
some abstract state transition model using e.g., the ETL func-           p ∨ q ≡ ¬(¬p ∧ ¬q)
tionality. This is already a complex problem because finite ab-          AX p ≡ ¬EX ¬p
stractions for things like recursion and heap allocations need           AF p ≡ A (true U p)
to be found. In this paper, we assume that some technology as            EF p ≡ E (true U p)
in Spin model checker is used to this end. Then each compon-             AG p ≡ ¬E (true U ¬p)
ent architect will formulate safety and liveness properties in           EG p ≡ ¬A (true U ¬p)
temporal logics that can be verified by the system as the final
step. These tasks by themselves should already embody a sub-             The CTL presumes that a computing system is represented
stantial stress test of the database system itself. Often, the       as a Kripke structure K = (S, R, L), where S is the finite set of
source code is generated from state diagrams for protocols, or       states, R ⊆ S × S is the state transition relation with (s, t) ∈R if
grammars, and these specifications can be used directly in-          t is an immediate successor of s, and L: S × P →{true, false}.
stead.                                                               A path is a potentially infinite sequence of successive states.
   In this paper, we focus on implementing a Model Checking          In our toy example of Figure 1, AX P0, EG P0, EF P1, AG
Engine as an SQL application. The idea here is to use SQL as         P0∨P1 are true in S0
scalability vehicle for massive-parallel model checking. Dia-
                                                                                  S0: P0                  S1: P0, P1                  S1: P1
lects of SQL, the lingua franca, of most relational databases
are already a very powerful language that found its interesting
usages beyond the traditional OLTP and OLAP scopes, e.g., to          Fig 1 A sample state-transition diagram with initial state S0 and two atomic
solve puzzles [7]. And when the SQL's expressiveness is not                                       fornulae P0 and P1.
sufficient, we can resort to an efficient database-system-integ-
III. KRIPKE SCHEMA                                  for the attribute 'RESULT' if s satisfies p or 'FALSE' otherwise.
   In this section we present a way of translating the Kripke               The SQL statements given below are written in Oracle
structure using database relations. The state transition diagram            11gR2's SQL [6] as close as possible to ANSI SQL and are
of Figure 1 translates to the instance of the Kripke schema                 just meant to give the reader a flavor of the idea; we claim
outlined in Table 1. As we incorporated id's into the names in              neither their particular elegance nor efficiency.
this example, we focus solely on non-trivial relations valu-                   The algorithm of constructing a SQL representation
ation and transition. A negation not P is implied when the                  sql(state_id, p) of CTL is given using the structural induction
atomic proposition P is not shown in the state and analogously              over CTL(P).
when there is no corresponding entry in the valuation relation.             A. sql(state_id, 'FALSE')
The tuple (null, 0) in the transition relation specifies that the
state with s_id = 0 is the initial state in this state transition sys-         This formula cannot be satisfied when the state with
tem.                                                                        state_id exists.
                                                                            select
create    table state (                                                       case count (*)
   s_id   number primary key,                                                   when 0 then NULL
   s_nm   varchar2(10)                                                          else         'FALSE'
);                                                                            end as result
insert    into state values(0, 'S_0');                                      from state
insert    into state values(1, 'S_1');                                      where state.s_id = state_id;
insert    into state values(2, 'S_2');

create    table atomic (                                                    B. sql(state_id, 'TRUE')
   a_id   number primary key,
   a_nm   varchar2(10)                                                         This formula is always satisfied when the state with
);                                                                          state_id exists.
insert    into atomic values(0, 'P_0');
insert    into atomic values(1, 'P_1');                                     select
                                                                              case count (*)
create    table valuation (                                                     when 0 then NULL
   s_id   number references state(s_id),                                        else         'TRUE'
   a_id   number references atomic(a_id)                                      end as result
);                                                                          from state
insert    into   valuation     values(0,      0);                           where state.s_id = state_id;
insert    into   valuation     values(1,      0);
insert    into   valuation     values(1,      1);
insert    into   valuation     values(2,      1);                           C. sql(state_id, atomic_id)
                                                                               An atomic propositional formula is satisfied when there is a
create table transition (
   src_id number references state(s_id),                                    tuple (state_id, atomic_id) in the relation atomic.
   tgt_id number references state(s_id)
);                                                                          select
insert into transition values(null, 1);                                       case count (*)
insert into transition values(0, 1);                                            when 0 then NULL
insert into transition values(1, 0);                                            else         'TRUE'
insert into transition values(1, 2);                                          end as result
                                                                            from valuation
                                                                            where      valuation.a_id = atomic_id
                    valuation          s_id    a_id                                and valuation.s_id = state_id;
                                       0       0
                                                                            D. sql(state_id, ¬p)
                                       1       0
                                                                              The negation of p satisfied when p is false.
                                       1       1
                                                                            with subq as (
                                       2       1                              sql(state_id, p)
                                                                            )
                                                                            select
                                                                              case subq.result
                  transition       src_id       tgt_id                          when 'TRUE' then 'FALSE'
                                   null         0                               else             'TRUE'
                                                                              end as result
                                   0            1                           from subq;

                                   1            0                           E. sql(state_id, p ∧ q)
                                   1            2                             The conjunction is satisfied when both p and q are satisfied.
   Fig 2 A sample relational representation of Kripke structure of Fig 1.   with subq_p as (
                                                                               sql(state_id, p)
            IV. MODEL CHECKER AS AN SQL APPLICATION                         ),    subq_q as (
                                                                               sql(state_id, q)
   In this section we translate basic CTL formulae into execut-             )
                                                                            select
able SQL queries as an implementation of the basic explicit                    case count(*)
model checking algorithm [1]. For a p ∈ CTL(P) and s ∈ S let                     when 0 then 'FALSE'
                                                                                 else         'TRUE'
sql(state_id, p) denote an SQL statement that returns 'TRUE'                   end as result
from subq_p natural join subq_q                                      begin
where result = 'TRUE';                                                 insert into temp (sql(state_id, q));
                                                                       commit; -- autonomous transaction
F. sql(state_id, EX p)
                                                                       select count(*) into counter
   The disjunction is satisfied when state state_id is in the set      from temp
                                                                       where temp.rs = s_id;
of predecessors of states satisfying p.                                if counter  0 then
                                                                          return 'TRUE';
select                                                                 end if;
  case count(*)                                                        loop
    when 0 then 'FALSE'                                                   newstates := 0;
    else         'TRUE'                                                   for r1 in
  end as result                                                           (
from transition t                                                           select t1.src_id
where      t.src_id = state_id                                              from         temp
       and 'TRUE' = (sql(t.tgt_id, p));                                         join transition t1
                                                                                     on (
G. sql(state_id, E (p U q))                                                                  temp.rs = t1.tgt_id
                                                                                        and 'TRUE' = (sql(t1.src_id, p))
   This formula is satisfied when state_id is in the set of states                   )
satisfying q or state_id is reachable through recursive reverse           )
                                                                          loop
traversal from the set of states already known to satisfy the               select count(*) into counter
formula. In each recursive step we add states that satisfy p.               from transition t2
                                                                            where        t2.src_id = r1.src_id
Since the state transition diagram may be cyclic, we use the                        and t2.tgt_id not in (
cycle detection clause.                                                                     select * from temp tt3
                                                                                         );
with subq_EpUq (rs) as (                                                    if counter = 0 then
  select s_id as rs                                                            if r1.src_id = s_id then
  from state                                                                     return 'TRUE';
  where 'TRUE' = (sql(s_id, q))                                              else
union all                                                                        begin
  select t.src_id as rs                                                             insert into temp values (r1.src_id);
  from       subq_EpUq                                                              commit; -- autonomous transaction
       join transition t                                                            newstates := newstates + 1;
          on (                                                                   exception
                   subq_EpUq.rs = t.tgt_id                                          when dup_val_on_index then
               and 'TRUE' = (sql(t.src_id, p))                                       dbms_output.put_line(
          )                                                                              'ignored duplicate');
)                                                                                end;
cycle rs set is_cycle to 'y' default 'n'                                       end if;
select                                                                      end if;
  case count(*)                                                           end loop;
    when 0 then 'FALSE'                                                   if newstates = 0 then
    else          'TRUE'                                                    return 'FALSE';
  end as result                                                           end if;
from EpUq                                                              end loop;
where rs = state_id;                                                 end;
                                                                     select ApUq() as result from
                                                                     dual;
H. sql(state_id, A (p U q))
   This formula is computed similarly to the existentially              This sample implementation can be further optimized at
quantified formula above with the difference that in every re-       different levels. From the model checking perspective, the ba-
cursive step we make sure to not add states that have at least       sic explicit algorithm is known to be outperformed by the
one successor that is not in the result set of the previous step.    symbolic model checking [4] using OBDD-encoded Boolean
Hence, more than one reference to the result set computed in         functions [5]. From the database perspective, we would start
the previous recursion step: predecessor computation and the         looking at using the horizontal scalability features such as Par-
check whether all successors of the predecessor are in the pre-      allel Pipelined Table Functions (PTF) in case of Oracle [6], or
vious set already. Therefore, this formula cannot be computed        similar techniques such as MapReduce [2] depending on the
with the plain recursive SQL as above. Instead we develop a          vendor's functionality. As you notice in this section the queries
PL/SQL stored function and use a temporary table to achieve          implementing a composite CTL formula might consist of
the desired behavior.                                                many subqueries that can be run in parallel. Many existential
                                                                     queries will benefit from the ability to stream the query hits
drop table temp;
create global temporary table temp (                                 early before the whole result set is formed as can be done with
  rs number primary key                                              PTF.
)
on commit preserve rows;
                                                                                        V. BENCHMARK PROPOSALS
create or replace function ApUq()
return varchar2                                                        In terms of self-verification it might be difficult to devise a
as                                                                   vendor-independent metric for the model checking bench-
   pragma autonomous_transaction;
   counter   number;                                                 mark. One such metric could be the percentage of the source
   newstates number;
code verified given a set of the CTL propositions that apply to   be implemented using the database system itself also presents
all products.                                                     an interesting test case in terms of traditional software testing.
   Fortunately, it is much easier to design an apple-to-apple        Further, we show a sample implementation of the basic ex-
benchmark if the verified system is a third-party product. We     plicit model checking algorithm using the combination of
suggest that a substantial open-source project at the scale of    Oracle 11.2 SQL and PL/SQL. Then we point out a couple of
Linux or MySQL is used as the system under verification.          optimization areas where the vendors can work on excelling in
   As an example of properties we want to verify, consider        this benchmark. Last but not least, we suggest several bench-
two-phase locking (2PL) where there are distinct lock acquisi-    mark metrics.
tion and release phases for a transaction. With the event of
lock acquisition/release by a transaction t encoded as t_acq                                     REFERENCES
and t_rel, accordingly we can state:                              [1]   Clarke, E., Schlinghoff, B.: Model Checking, in Handbook of
   AG(¬t_rel ∨ AX(AG ¬t_acq))                                           Automated Reasoning, Volume 2, Elsevier and MIT, 1635-1790 (2001)
                                                                  [2]   Dean, J., Ghemawat, S.: Symposium on Operating System Design and
                                                                        Implementation (OSDI), San Francisco, CA (2004).
  We envision the following benchmark metrics:                    [3]   Emerson, E.: Temporal and Modal Logic, in Handbook of Theoretical
   • The fraction of the source code verified                           Computer Science, Volume B: Formal Models and Semantics, Elsevier
                                                                        and MIT, 995-1072 (1990)
   • The fraction of the formulae verified                        [4]   McMillan, K.: Symbolic Model Checking, Kluwer , Norwell, MA
   • The monetary cost of the setup needed for verifica-                (1993)
       tion                                                       [5]   Meinel, C., Theobald T.: Algorithms and Data Structures in VLSI
                                                                        Design OBDD Foundations and Applications, Springer, Heidelberg,
   • The amount energy spent per verification per source                (1998)
       code line                                                  [6]   Oracle Corp.: Oracle Database SQL Language Reference 11g Release
                                                                        2                                                           ( 1 1 . 2 ),
                      VI. CONCLUSION                                    http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/toc.
                                                                        htm
  This paper advocates spending recent scalability gains in       [7]   Sheffer, A.: Oracle RDBMS 11gR2 – Solving a Sudoku using
modern computing on finding rare and corner-case bugs in                Recursive                   Subquery                 Factoring,
database systems to improve their quality by means of fully             http://technology.amis.nl/blog/6404/oracle-rdbms-11gr2-solving-a-
automated model checking. The fact that model checking can              sudoku-using-recursive-subquery-factoring

Contenu connexe

Tendances

Programming in Scala - Lecture Three
Programming in Scala - Lecture ThreeProgramming in Scala - Lecture Three
Programming in Scala - Lecture ThreeAngelo Corsaro
 
Introduction to database-Normalisation
Introduction to database-NormalisationIntroduction to database-Normalisation
Introduction to database-NormalisationAjit Nayak
 
Introduction To Oracle Sql
Introduction To Oracle SqlIntroduction To Oracle Sql
Introduction To Oracle SqlAhmed Yaseen
 
Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013Prosanta Ghosh
 
4. SQL in DBMS
4. SQL in DBMS4. SQL in DBMS
4. SQL in DBMSkoolkampus
 
Dbms ii mca-ch8-db design-2013
Dbms ii mca-ch8-db design-2013Dbms ii mca-ch8-db design-2013
Dbms ii mca-ch8-db design-2013Prosanta Ghosh
 
From Declarative to Imperative Operation Specifications (ER 2007)
From Declarative to Imperative Operation Specifications (ER 2007)From Declarative to Imperative Operation Specifications (ER 2007)
From Declarative to Imperative Operation Specifications (ER 2007)Jordi Cabot
 
Java căn bản - Chapter3
Java căn bản - Chapter3Java căn bản - Chapter3
Java căn bản - Chapter3Vince Vo
 
2 data types and operators in r
2 data types and operators in r2 data types and operators in r
2 data types and operators in rDr Nisha Arora
 
5 the relational algebra and calculus
5 the relational algebra and calculus5 the relational algebra and calculus
5 the relational algebra and calculusKumar
 
An executable model for an Intelligent Vehicle Control System
An executable model for an Intelligent Vehicle Control SystemAn executable model for an Intelligent Vehicle Control System
An executable model for an Intelligent Vehicle Control Systeminfopapers
 

Tendances (20)

Programming in Scala - Lecture Three
Programming in Scala - Lecture ThreeProgramming in Scala - Lecture Three
Programming in Scala - Lecture Three
 
Making Logic Monad
Making Logic MonadMaking Logic Monad
Making Logic Monad
 
Introduction to database-Normalisation
Introduction to database-NormalisationIntroduction to database-Normalisation
Introduction to database-Normalisation
 
Introduction To Oracle Sql
Introduction To Oracle SqlIntroduction To Oracle Sql
Introduction To Oracle Sql
 
Unit04 dbms
Unit04 dbmsUnit04 dbms
Unit04 dbms
 
Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013
 
4. SQL in DBMS
4. SQL in DBMS4. SQL in DBMS
4. SQL in DBMS
 
Assignment#01
Assignment#01Assignment#01
Assignment#01
 
05 dataflow
05 dataflow05 dataflow
05 dataflow
 
Dbms ii mca-ch8-db design-2013
Dbms ii mca-ch8-db design-2013Dbms ii mca-ch8-db design-2013
Dbms ii mca-ch8-db design-2013
 
Db1 lecture4
Db1 lecture4Db1 lecture4
Db1 lecture4
 
From Declarative to Imperative Operation Specifications (ER 2007)
From Declarative to Imperative Operation Specifications (ER 2007)From Declarative to Imperative Operation Specifications (ER 2007)
From Declarative to Imperative Operation Specifications (ER 2007)
 
Java căn bản - Chapter3
Java căn bản - Chapter3Java căn bản - Chapter3
Java căn bản - Chapter3
 
2 data types and operators in r
2 data types and operators in r2 data types and operators in r
2 data types and operators in r
 
Basic Analysis using Python
Basic Analysis using PythonBasic Analysis using Python
Basic Analysis using Python
 
Basic Analysis using R
Basic Analysis using RBasic Analysis using R
Basic Analysis using R
 
Programming in R
Programming in RProgramming in R
Programming in R
 
5 the relational algebra and calculus
5 the relational algebra and calculus5 the relational algebra and calculus
5 the relational algebra and calculus
 
An executable model for an Intelligent Vehicle Control System
An executable model for an Intelligent Vehicle Control SystemAn executable model for an Intelligent Vehicle Control System
An executable model for an Intelligent Vehicle Control System
 
1643 y є r relational calculus-1
1643 y є r  relational calculus-11643 y є r  relational calculus-1
1643 y є r relational calculus-1
 

En vedette

Integrated Data, Message, and Process Recovery for Failure Masking in Web Ser...
Integrated Data, Message, and Process Recovery for Failure Masking in Web Ser...Integrated Data, Message, and Process Recovery for Failure Masking in Web Ser...
Integrated Data, Message, and Process Recovery for Failure Masking in Web Ser...Gera Shegalov
 
cara membuat fotfolio sains tahun 6
cara membuat fotfolio sains tahun 6cara membuat fotfolio sains tahun 6
cara membuat fotfolio sains tahun 6Muadzam Peace
 
Why Being a Creeper is Awesome
Why Being a Creeper is AwesomeWhy Being a Creeper is Awesome
Why Being a Creeper is Awesomerelak213
 
Materi 2 teori teori belajar
Materi 2 teori teori belajarMateri 2 teori teori belajar
Materi 2 teori teori belajarNhia Item
 
The Role of Database Systems in the Era of Big Data
The Role  of Database Systems  in the Era of Big DataThe Role  of Database Systems  in the Era of Big Data
The Role of Database Systems in the Era of Big DataGera Shegalov
 
Thermo part 2
Thermo part 2Thermo part 2
Thermo part 2elly_q3a
 
Apache Drill @ PJUG, Jan 15, 2013
Apache Drill @ PJUG, Jan 15, 2013Apache Drill @ PJUG, Jan 15, 2013
Apache Drill @ PJUG, Jan 15, 2013Gera Shegalov
 
Materi 1 hakekat psikologi
Materi 1 hakekat psikologiMateri 1 hakekat psikologi
Materi 1 hakekat psikologiNhia Item
 
Hadoop 2 @ Twitter, Elephant Scale
Hadoop 2 @ Twitter, Elephant Scale Hadoop 2 @ Twitter, Elephant Scale
Hadoop 2 @ Twitter, Elephant Scale Gera Shegalov
 
Responsive Web Design – Best Practice Approach
Responsive Web Design – Best Practice ApproachResponsive Web Design – Best Practice Approach
Responsive Web Design – Best Practice Approachlet's dev GmbH & Co. KG
 

En vedette (17)

Integrated Data, Message, and Process Recovery for Failure Masking in Web Ser...
Integrated Data, Message, and Process Recovery for Failure Masking in Web Ser...Integrated Data, Message, and Process Recovery for Failure Masking in Web Ser...
Integrated Data, Message, and Process Recovery for Failure Masking in Web Ser...
 
cara membuat fotfolio sains tahun 6
cara membuat fotfolio sains tahun 6cara membuat fotfolio sains tahun 6
cara membuat fotfolio sains tahun 6
 
Fr
FrFr
Fr
 
Usl6
Usl6Usl6
Usl6
 
Why Being a Creeper is Awesome
Why Being a Creeper is AwesomeWhy Being a Creeper is Awesome
Why Being a Creeper is Awesome
 
Materi 2 teori teori belajar
Materi 2 teori teori belajarMateri 2 teori teori belajar
Materi 2 teori teori belajar
 
Place
PlacePlace
Place
 
The Role of Database Systems in the Era of Big Data
The Role  of Database Systems  in the Era of Big DataThe Role  of Database Systems  in the Era of Big Data
The Role of Database Systems in the Era of Big Data
 
Regolamento tarsu
Regolamento tarsuRegolamento tarsu
Regolamento tarsu
 
Ppr1
Ppr1Ppr1
Ppr1
 
Thermo part 2
Thermo part 2Thermo part 2
Thermo part 2
 
Apache Drill @ PJUG, Jan 15, 2013
Apache Drill @ PJUG, Jan 15, 2013Apache Drill @ PJUG, Jan 15, 2013
Apache Drill @ PJUG, Jan 15, 2013
 
Presentación2
Presentación2Presentación2
Presentación2
 
Materi 1 hakekat psikologi
Materi 1 hakekat psikologiMateri 1 hakekat psikologi
Materi 1 hakekat psikologi
 
Hadoop 2 @ Twitter, Elephant Scale
Hadoop 2 @ Twitter, Elephant Scale Hadoop 2 @ Twitter, Elephant Scale
Hadoop 2 @ Twitter, Elephant Scale
 
Biynees khemjee awah
Biynees khemjee awahBiynees khemjee awah
Biynees khemjee awah
 
Responsive Web Design – Best Practice Approach
Responsive Web Design – Best Practice ApproachResponsive Web Design – Best Practice Approach
Responsive Web Design – Best Practice Approach
 

Similaire à CTL Model Checking in Database Cloud

6 integrity and security
6 integrity and security6 integrity and security
6 integrity and securityDilip G R
 
C sharp_basic_ideas
C sharp_basic_ideasC sharp_basic_ideas
C sharp_basic_ideasRalph Weber
 
4_RelationalDataModelAndRelationalMapping.pdf
4_RelationalDataModelAndRelationalMapping.pdf4_RelationalDataModelAndRelationalMapping.pdf
4_RelationalDataModelAndRelationalMapping.pdfLPhct2
 
Slides11
Slides11Slides11
Slides11jayalo
 
JDBC for CSQL Database
JDBC for CSQL DatabaseJDBC for CSQL Database
JDBC for CSQL Databasejitendral
 
Arrays and lists in sql server 2008
Arrays and lists in sql server 2008Arrays and lists in sql server 2008
Arrays and lists in sql server 2008nxthuong
 
INTERVIEW QUESTIONS_Verilog_PART-2.pdf
INTERVIEW QUESTIONS_Verilog_PART-2.pdfINTERVIEW QUESTIONS_Verilog_PART-2.pdf
INTERVIEW QUESTIONS_Verilog_PART-2.pdfDrViswanathKalannaga1
 
SF Scala meet up, lighting talk: SPA -- Scala JDBC wrapper
SF Scala meet up, lighting talk: SPA -- Scala JDBC wrapperSF Scala meet up, lighting talk: SPA -- Scala JDBC wrapper
SF Scala meet up, lighting talk: SPA -- Scala JDBC wrapperChester Chen
 
Preparatory_questions_final_exam_DigitalElectronics1 (1).pdf
Preparatory_questions_final_exam_DigitalElectronics1 (1).pdfPreparatory_questions_final_exam_DigitalElectronics1 (1).pdf
Preparatory_questions_final_exam_DigitalElectronics1 (1).pdfrdjo
 

Similaire à CTL Model Checking in Database Cloud (20)

6 integrity and security
6 integrity and security6 integrity and security
6 integrity and security
 
2e data models
2e   data models2e   data models
2e data models
 
Ch6
Ch6Ch6
Ch6
 
JPA 2.0
JPA 2.0JPA 2.0
JPA 2.0
 
Integrity & security
Integrity & securityIntegrity & security
Integrity & security
 
C sharp_basic_ideas
C sharp_basic_ideasC sharp_basic_ideas
C sharp_basic_ideas
 
4_RelationalDataModelAndRelationalMapping.pdf
4_RelationalDataModelAndRelationalMapping.pdf4_RelationalDataModelAndRelationalMapping.pdf
4_RelationalDataModelAndRelationalMapping.pdf
 
Hd2
Hd2Hd2
Hd2
 
Slides11
Slides11Slides11
Slides11
 
JDBC for CSQL Database
JDBC for CSQL DatabaseJDBC for CSQL Database
JDBC for CSQL Database
 
04_AJMS_453_22_compressed.pdf
04_AJMS_453_22_compressed.pdf04_AJMS_453_22_compressed.pdf
04_AJMS_453_22_compressed.pdf
 
Arrays and lists in sql server 2008
Arrays and lists in sql server 2008Arrays and lists in sql server 2008
Arrays and lists in sql server 2008
 
INTERVIEW QUESTIONS_Verilog_PART-2.pdf
INTERVIEW QUESTIONS_Verilog_PART-2.pdfINTERVIEW QUESTIONS_Verilog_PART-2.pdf
INTERVIEW QUESTIONS_Verilog_PART-2.pdf
 
B T0065
B T0065B T0065
B T0065
 
SF Scala meet up, lighting talk: SPA -- Scala JDBC wrapper
SF Scala meet up, lighting talk: SPA -- Scala JDBC wrapperSF Scala meet up, lighting talk: SPA -- Scala JDBC wrapper
SF Scala meet up, lighting talk: SPA -- Scala JDBC wrapper
 
Preparatory_questions_final_exam_DigitalElectronics1 (1).pdf
Preparatory_questions_final_exam_DigitalElectronics1 (1).pdfPreparatory_questions_final_exam_DigitalElectronics1 (1).pdf
Preparatory_questions_final_exam_DigitalElectronics1 (1).pdf
 
RDBMS
RDBMSRDBMS
RDBMS
 
Oracle SQL Advanced
Oracle SQL AdvancedOracle SQL Advanced
Oracle SQL Advanced
 
Sql
SqlSql
Sql
 
Sqlapi0.1
Sqlapi0.1Sqlapi0.1
Sqlapi0.1
 

Plus de Gera Shegalov

#SlimScalding - Less Memory is More Capacity
#SlimScalding - Less Memory is More Capacity#SlimScalding - Less Memory is More Capacity
#SlimScalding - Less Memory is More CapacityGera Shegalov
 
Integrated Data, Message, and Process Recovery for Failure Masking in Web Ser...
Integrated Data, Message, and Process Recovery for Failure Masking in Web Ser...Integrated Data, Message, and Process Recovery for Failure Masking in Web Ser...
Integrated Data, Message, and Process Recovery for Failure Masking in Web Ser...Gera Shegalov
 
Logging Last Resource Optimization for Distributed Transactions in Oracle We...
Logging Last Resource Optimization for Distributed Transactions in  Oracle We...Logging Last Resource Optimization for Distributed Transactions in  Oracle We...
Logging Last Resource Optimization for Distributed Transactions in Oracle We...Gera Shegalov
 
Logging Last Resource Optimization for Distributed Transactions in Oracle…
Logging Last Resource Optimization for Distributed Transactions in  Oracle…Logging Last Resource Optimization for Distributed Transactions in  Oracle…
Logging Last Resource Optimization for Distributed Transactions in Oracle…Gera Shegalov
 
Transaction Timestamping in Temporal Databases
Transaction Timestamping in Temporal DatabasesTransaction Timestamping in Temporal Databases
Transaction Timestamping in Temporal DatabasesGera Shegalov
 
Unstoppable Stateful PHP Web Services
Unstoppable Stateful PHP Web ServicesUnstoppable Stateful PHP Web Services
Unstoppable Stateful PHP Web ServicesGera Shegalov
 
Formal Verification of Transactional Interaction Contract
Formal Verification of Transactional Interaction ContractFormal Verification of Transactional Interaction Contract
Formal Verification of Transactional Interaction ContractGera Shegalov
 
Formal Verification of Web Service Interaction Contracts
Formal Verification of Web Service Interaction ContractsFormal Verification of Web Service Interaction Contracts
Formal Verification of Web Service Interaction ContractsGera Shegalov
 

Plus de Gera Shegalov (8)

#SlimScalding - Less Memory is More Capacity
#SlimScalding - Less Memory is More Capacity#SlimScalding - Less Memory is More Capacity
#SlimScalding - Less Memory is More Capacity
 
Integrated Data, Message, and Process Recovery for Failure Masking in Web Ser...
Integrated Data, Message, and Process Recovery for Failure Masking in Web Ser...Integrated Data, Message, and Process Recovery for Failure Masking in Web Ser...
Integrated Data, Message, and Process Recovery for Failure Masking in Web Ser...
 
Logging Last Resource Optimization for Distributed Transactions in Oracle We...
Logging Last Resource Optimization for Distributed Transactions in  Oracle We...Logging Last Resource Optimization for Distributed Transactions in  Oracle We...
Logging Last Resource Optimization for Distributed Transactions in Oracle We...
 
Logging Last Resource Optimization for Distributed Transactions in Oracle…
Logging Last Resource Optimization for Distributed Transactions in  Oracle…Logging Last Resource Optimization for Distributed Transactions in  Oracle…
Logging Last Resource Optimization for Distributed Transactions in Oracle…
 
Transaction Timestamping in Temporal Databases
Transaction Timestamping in Temporal DatabasesTransaction Timestamping in Temporal Databases
Transaction Timestamping in Temporal Databases
 
Unstoppable Stateful PHP Web Services
Unstoppable Stateful PHP Web ServicesUnstoppable Stateful PHP Web Services
Unstoppable Stateful PHP Web Services
 
Formal Verification of Transactional Interaction Contract
Formal Verification of Transactional Interaction ContractFormal Verification of Transactional Interaction Contract
Formal Verification of Transactional Interaction Contract
 
Formal Verification of Web Service Interaction Contracts
Formal Verification of Web Service Interaction ContractsFormal Verification of Web Service Interaction Contracts
Formal Verification of Web Service Interaction Contracts
 

Dernier

Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 

Dernier (20)

Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 

CTL Model Checking in Database Cloud

  • 1. CTL Model Checking in Database Cloud German Shegalov Oracle Corp. 500 Oracle Parkway, Redwood Shores, CA 94065, USA german.shegalov@oracle.com Abstract— Modern software systems such as OS, RDBMS, JVM, rated virtual machine that will close the gap for any Tur- etc have reached enormous complexity by any metric ranging ing-computable problem. The task of a model checker is to from the number of lines of code to the program state explosion verify whether the system under test satisfies a property posed due to concurrency. Standard quality assurance methods do not as a formulae in temporal logics such as CTL. yield strong correctness guarantees because even 100% code cov- erage – while a desirable metric – is not equivalent to the II. CTL BACKGROUND state/execution path coverage. Whereas model checking provides rigor correctness proofs, its computational complexity is often Model checking is a formal method of software/hardware prohibitive for real world systems. With advances of distributed verification – an automated way of providing mathematical computing frameworks such as MapReduce, and affordability of proofs [1]. In this paper, we deal with the Computational Tree large computer clusters (e.g., offered as an on-demand Cloud ser- Logic (CTL) [3] model checking. vice), steadily larger systems can be verified using model check- Along with the traditional Boolean operators, CTL defines ing. In this paper, we envision database vendors compete for the existential path quantifier E and the universal path quanti- achieving the highest possible degree of verification using fier A for the paths originating in some state s. Temporal as- massive scalability features. To this end, we show a way of imple- menting a CTL model checker as an SQL application that a data- pects are expressed using the unary modalities neXt (refers to base system will “tune” for the cloud. successor state), Globally (all reachable states satisfy the for- mula), Finally (a reachable state satisfies the formula), and the I. INTRODUCTION binary modality Until (the left-hand formula is valid at least In this paper, we demonstrate a relatively simple way to until a state is reached where the right-hand formula holds). turn a relational database system in a powerful verification The unary modalities are usually most relevant in the praxis. tool. We show only a very basic technique of implementing a The set of CTL formulae over a finite set of atomic propos- model checker inside a database system. The idea is to en- itions P, denoted as CTL(P), is formally defined as follows us- courage database vendors to compete not only on perform- ing the structural induction: ance-oriented benchmark but on merits of objective software p ∈ P implies p ∈ CTL(P) quality as well. An interesting side effect of this is that the {p, q} ⊆ CTL(P) implies {¬p, p ∧ q, EX p, E (p U q), A (p database system will be able to verify its own concurrency U q)} ⊆ CTL(P) control and recovery protocols. Given basic formulae defined above, the following short- Several steps are required on the way towards software hand syntax is provided as equivalent to formulae in the basic verification. First the source code has to be converted into set: some abstract state transition model using e.g., the ETL func- p ∨ q ≡ ¬(¬p ∧ ¬q) tionality. This is already a complex problem because finite ab- AX p ≡ ¬EX ¬p stractions for things like recursion and heap allocations need AF p ≡ A (true U p) to be found. In this paper, we assume that some technology as EF p ≡ E (true U p) in Spin model checker is used to this end. Then each compon- AG p ≡ ¬E (true U ¬p) ent architect will formulate safety and liveness properties in EG p ≡ ¬A (true U ¬p) temporal logics that can be verified by the system as the final step. These tasks by themselves should already embody a sub- The CTL presumes that a computing system is represented stantial stress test of the database system itself. Often, the as a Kripke structure K = (S, R, L), where S is the finite set of source code is generated from state diagrams for protocols, or states, R ⊆ S × S is the state transition relation with (s, t) ∈R if grammars, and these specifications can be used directly in- t is an immediate successor of s, and L: S × P →{true, false}. stead. A path is a potentially infinite sequence of successive states. In this paper, we focus on implementing a Model Checking In our toy example of Figure 1, AX P0, EG P0, EF P1, AG Engine as an SQL application. The idea here is to use SQL as P0∨P1 are true in S0 scalability vehicle for massive-parallel model checking. Dia- S0: P0 S1: P0, P1 S1: P1 lects of SQL, the lingua franca, of most relational databases are already a very powerful language that found its interesting usages beyond the traditional OLTP and OLAP scopes, e.g., to Fig 1 A sample state-transition diagram with initial state S0 and two atomic solve puzzles [7]. And when the SQL's expressiveness is not fornulae P0 and P1. sufficient, we can resort to an efficient database-system-integ-
  • 2. III. KRIPKE SCHEMA for the attribute 'RESULT' if s satisfies p or 'FALSE' otherwise. In this section we present a way of translating the Kripke The SQL statements given below are written in Oracle structure using database relations. The state transition diagram 11gR2's SQL [6] as close as possible to ANSI SQL and are of Figure 1 translates to the instance of the Kripke schema just meant to give the reader a flavor of the idea; we claim outlined in Table 1. As we incorporated id's into the names in neither their particular elegance nor efficiency. this example, we focus solely on non-trivial relations valu- The algorithm of constructing a SQL representation ation and transition. A negation not P is implied when the sql(state_id, p) of CTL is given using the structural induction atomic proposition P is not shown in the state and analogously over CTL(P). when there is no corresponding entry in the valuation relation. A. sql(state_id, 'FALSE') The tuple (null, 0) in the transition relation specifies that the state with s_id = 0 is the initial state in this state transition sys- This formula cannot be satisfied when the state with tem. state_id exists. select create table state ( case count (*) s_id number primary key, when 0 then NULL s_nm varchar2(10) else 'FALSE' ); end as result insert into state values(0, 'S_0'); from state insert into state values(1, 'S_1'); where state.s_id = state_id; insert into state values(2, 'S_2'); create table atomic ( B. sql(state_id, 'TRUE') a_id number primary key, a_nm varchar2(10) This formula is always satisfied when the state with ); state_id exists. insert into atomic values(0, 'P_0'); insert into atomic values(1, 'P_1'); select case count (*) create table valuation ( when 0 then NULL s_id number references state(s_id), else 'TRUE' a_id number references atomic(a_id) end as result ); from state insert into valuation values(0, 0); where state.s_id = state_id; insert into valuation values(1, 0); insert into valuation values(1, 1); insert into valuation values(2, 1); C. sql(state_id, atomic_id) An atomic propositional formula is satisfied when there is a create table transition ( src_id number references state(s_id), tuple (state_id, atomic_id) in the relation atomic. tgt_id number references state(s_id) ); select insert into transition values(null, 1); case count (*) insert into transition values(0, 1); when 0 then NULL insert into transition values(1, 0); else 'TRUE' insert into transition values(1, 2); end as result from valuation where valuation.a_id = atomic_id valuation s_id a_id and valuation.s_id = state_id; 0 0 D. sql(state_id, ¬p) 1 0 The negation of p satisfied when p is false. 1 1 with subq as ( 2 1 sql(state_id, p) ) select case subq.result transition src_id tgt_id when 'TRUE' then 'FALSE' null 0 else 'TRUE' end as result 0 1 from subq; 1 0 E. sql(state_id, p ∧ q) 1 2 The conjunction is satisfied when both p and q are satisfied. Fig 2 A sample relational representation of Kripke structure of Fig 1. with subq_p as ( sql(state_id, p) IV. MODEL CHECKER AS AN SQL APPLICATION ), subq_q as ( sql(state_id, q) In this section we translate basic CTL formulae into execut- ) select able SQL queries as an implementation of the basic explicit case count(*) model checking algorithm [1]. For a p ∈ CTL(P) and s ∈ S let when 0 then 'FALSE' else 'TRUE' sql(state_id, p) denote an SQL statement that returns 'TRUE' end as result
  • 3. from subq_p natural join subq_q begin where result = 'TRUE'; insert into temp (sql(state_id, q)); commit; -- autonomous transaction F. sql(state_id, EX p) select count(*) into counter The disjunction is satisfied when state state_id is in the set from temp where temp.rs = s_id; of predecessors of states satisfying p. if counter 0 then return 'TRUE'; select end if; case count(*) loop when 0 then 'FALSE' newstates := 0; else 'TRUE' for r1 in end as result ( from transition t select t1.src_id where t.src_id = state_id from temp and 'TRUE' = (sql(t.tgt_id, p)); join transition t1 on ( G. sql(state_id, E (p U q)) temp.rs = t1.tgt_id and 'TRUE' = (sql(t1.src_id, p)) This formula is satisfied when state_id is in the set of states ) satisfying q or state_id is reachable through recursive reverse ) loop traversal from the set of states already known to satisfy the select count(*) into counter formula. In each recursive step we add states that satisfy p. from transition t2 where t2.src_id = r1.src_id Since the state transition diagram may be cyclic, we use the and t2.tgt_id not in ( cycle detection clause. select * from temp tt3 ); with subq_EpUq (rs) as ( if counter = 0 then select s_id as rs if r1.src_id = s_id then from state return 'TRUE'; where 'TRUE' = (sql(s_id, q)) else union all begin select t.src_id as rs insert into temp values (r1.src_id); from subq_EpUq commit; -- autonomous transaction join transition t newstates := newstates + 1; on ( exception subq_EpUq.rs = t.tgt_id when dup_val_on_index then and 'TRUE' = (sql(t.src_id, p)) dbms_output.put_line( ) 'ignored duplicate'); ) end; cycle rs set is_cycle to 'y' default 'n' end if; select end if; case count(*) end loop; when 0 then 'FALSE' if newstates = 0 then else 'TRUE' return 'FALSE'; end as result end if; from EpUq end loop; where rs = state_id; end; select ApUq() as result from dual; H. sql(state_id, A (p U q)) This formula is computed similarly to the existentially This sample implementation can be further optimized at quantified formula above with the difference that in every re- different levels. From the model checking perspective, the ba- cursive step we make sure to not add states that have at least sic explicit algorithm is known to be outperformed by the one successor that is not in the result set of the previous step. symbolic model checking [4] using OBDD-encoded Boolean Hence, more than one reference to the result set computed in functions [5]. From the database perspective, we would start the previous recursion step: predecessor computation and the looking at using the horizontal scalability features such as Par- check whether all successors of the predecessor are in the pre- allel Pipelined Table Functions (PTF) in case of Oracle [6], or vious set already. Therefore, this formula cannot be computed similar techniques such as MapReduce [2] depending on the with the plain recursive SQL as above. Instead we develop a vendor's functionality. As you notice in this section the queries PL/SQL stored function and use a temporary table to achieve implementing a composite CTL formula might consist of the desired behavior. many subqueries that can be run in parallel. Many existential queries will benefit from the ability to stream the query hits drop table temp; create global temporary table temp ( early before the whole result set is formed as can be done with rs number primary key PTF. ) on commit preserve rows; V. BENCHMARK PROPOSALS create or replace function ApUq() return varchar2 In terms of self-verification it might be difficult to devise a as vendor-independent metric for the model checking bench- pragma autonomous_transaction; counter number; mark. One such metric could be the percentage of the source newstates number;
  • 4. code verified given a set of the CTL propositions that apply to be implemented using the database system itself also presents all products. an interesting test case in terms of traditional software testing. Fortunately, it is much easier to design an apple-to-apple Further, we show a sample implementation of the basic ex- benchmark if the verified system is a third-party product. We plicit model checking algorithm using the combination of suggest that a substantial open-source project at the scale of Oracle 11.2 SQL and PL/SQL. Then we point out a couple of Linux or MySQL is used as the system under verification. optimization areas where the vendors can work on excelling in As an example of properties we want to verify, consider this benchmark. Last but not least, we suggest several bench- two-phase locking (2PL) where there are distinct lock acquisi- mark metrics. tion and release phases for a transaction. With the event of lock acquisition/release by a transaction t encoded as t_acq REFERENCES and t_rel, accordingly we can state: [1] Clarke, E., Schlinghoff, B.: Model Checking, in Handbook of AG(¬t_rel ∨ AX(AG ¬t_acq)) Automated Reasoning, Volume 2, Elsevier and MIT, 1635-1790 (2001) [2] Dean, J., Ghemawat, S.: Symposium on Operating System Design and Implementation (OSDI), San Francisco, CA (2004). We envision the following benchmark metrics: [3] Emerson, E.: Temporal and Modal Logic, in Handbook of Theoretical • The fraction of the source code verified Computer Science, Volume B: Formal Models and Semantics, Elsevier and MIT, 995-1072 (1990) • The fraction of the formulae verified [4] McMillan, K.: Symbolic Model Checking, Kluwer , Norwell, MA • The monetary cost of the setup needed for verifica- (1993) tion [5] Meinel, C., Theobald T.: Algorithms and Data Structures in VLSI Design OBDD Foundations and Applications, Springer, Heidelberg, • The amount energy spent per verification per source (1998) code line [6] Oracle Corp.: Oracle Database SQL Language Reference 11g Release 2 ( 1 1 . 2 ), VI. CONCLUSION http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/toc. htm This paper advocates spending recent scalability gains in [7] Sheffer, A.: Oracle RDBMS 11gR2 – Solving a Sudoku using modern computing on finding rare and corner-case bugs in Recursive Subquery Factoring, database systems to improve their quality by means of fully http://technology.amis.nl/blog/6404/oracle-rdbms-11gr2-solving-a- automated model checking. The fact that model checking can sudoku-using-recursive-subquery-factoring