Event Based Sequential Program Development: Application to Constructing a Pointer Program

Similar documents
Extensional Equality in Intensional Type Theory

A Calculus for End-to-end Statistical Service Guarantees

Implementing Domain Specific Languages using Dependent Types and Partial Evaluation

Nominal Techniques in Isabelle/HOL

Refinement in Requirements Specification and Analysis: a Case Study

Two-Way Equational Tree Automata for AC-like Theories: Decidability and Closure Properties

solutions:, and it cannot be the case that a supersolution is always greater than or equal to a subsolution.

ishares Core Composite Bond ETF

½ Ê Ú Û Ó ÆÒ ÕÙÓØ ÒØ ¾ ÇÖØ Ó ÓÒ Ð ÒÚ Ö ÒØ ÓÙ Ð Ö Ø ÓÒ Ý ÕÙÓØ ÒØ Ñ Ô ÇÖ Ø ÓÖÖ ÔÓÒ Ò Ü ÑÔÐ Ó ÓÖ Ø ÓÖÖ ÔÓÒ Ò Ü ÑÔÐ Ø Ò ÓÖ ÔÖÓ ÙØ Ü ÑÔÐ ÓÒØÖ Ø ÓÒ Ñ Ô ÇÔ Ò

Solutions of Implication Constraints yield Type Inference for More General Algebraic Data Types

ÈÖÓÚ Ò Ò ÁÑÔÐ Ø ÓÒ È É Ï Ö Ø ÐÓÓ Ø Û Ý ØÓ ÔÖÓÚ Ø Ø Ñ ÒØ Ó Ø ÓÖÑ Á È Ø Ò É ÓÖ È É Ì ÓÐÐÓÛ Ò ÔÖÓÓ ØÝÔ Ò Ð Ó Ù ØÓ ÔÖÓÚ Ø Ø Ñ ÒØ Ó Ø ÓÖÑ Ü È Üµ É Üµµ Ý ÔÔ

A Formal Architecture for the 3APL Agent Programming Language

Deadlock. deadlock analysis - primitive processes, parallel composition, avoidance

Decomposition and Complexity of Hereditary History Preserving Bisimulation on BPP

É ÀÓÛ Ó Ý Ò ² Ö Ò ÁÒ Ö Ò «Ö ÓØ ÑÔ Ù ÔÖÓ Ð ØÝ ØÓ Ö ÙÒ ÖØ ÒØÝ ÙØ Ø Ý ÓÒ Ø ÓÒ ÓÒ «Ö ÒØ Ø Ò º Ü ÑÔÐ ÁÑ Ò Ð Ò Ð ØÖ Ð Û Ø Ò ½ Ñ Ø Ô Ö Ó Ù Ø º ÁÒ Ô Ö ÓÒ Ù Ø

Domain, Range, Inverse

Ë ÁÌÇ ÌÓ Ó ÍÒ Ú Ö Øݵ Ç ¼ Ô Û Ö ÙÒÓ Ø Ò Ð Ä Ò ÙÖ ÖÝ ÓÒ ÒÓØ Ý ÛÓÖ Û Ø Ã ÞÙ ÖÓ Á Ö Ó ÒØ Ë Ò ÝÓ ÍÒ Ú Ö Øݵ Ç

ÔÖ Î µ ÛÖ Î Ø Ø Ó ÚÖØ ÖÔ Ø Ø Ó º ØØ Û Ö ÚÒ Ø Ò Ú ¼ ½ Ú ½ ¾ Ú ¾ Ú Ú ½ ÒÒ ÙÒØÓÒ Eº ÏÐ Ò Ø ÖÔ ÕÙÒ Ú ÛÖ Ú ¼ Ú ¾ Î ½ ¾ Ò E µ Ú ½ Ú º Ì ÛÐ ÐÓ Ø Ö Ø Ò Ð Ø ÚÖ

Contents. Bibliography 121. Index 123

MSR, Access Control, and the Most Powerful Attacker

ÙÒØ ÓÒ Ò Ø ÓÒ ÙÒØ ÓÒ ÖÓÑ ØÓ ÒÓØ Ö Ð Ø ÓÒ ÖÓÑ ØÓ Ù Ø Ø ÓÖ Ú ÖÝ Ü ¾ Ø Ö ÓÑ Ý ¾ Ù Ø Ø Ü Ýµ Ò Ø Ö Ð Ø ÓÒ Ò Ü Ýµ Ò Ü Þµ Ö Ò Ø Ö Ð Ø ÓÒ Ø Ò Ý Þº ÆÓØ Ø ÓÒ Á


Æ ÛØÓÒ³ Å Ø Ó ÐÓ Ì ÓÖÝ Ò ËÓÑ Ø Ò ÓÙ ÈÖÓ ÐÝ Ò³Ø ÃÒÓÛ ÓÙØ Ú º ÓÜ Ñ Ö Ø ÓÐÐ

Improved Boosting Algorithms Using Confidence-rated Predictions

½º»¾¼ º»¾¼ ¾º»¾¼ º»¾¼ º»¾¼ º»¾¼ º»¾¼ º»¾¼» ¼» ¼ ÌÓØ Ð»½ ¼

P(x) testing training. x Hi

Ä ÖÒ Ò ÖÓÑ Ø Ö Ëº Ù¹ÅÓ Ø Ð ÓÖÒ ÁÒ Ø ØÙØ Ó Ì ÒÓÐÓ Ý Ä ØÙÖ ½ Ì Ä ÖÒ Ò ÈÖÓ Ð Ñ ËÔÓÒ ÓÖ Ý ÐØ ³ ÈÖÓÚÓ Ø Ç ² Ë Ú ÓÒ Ò ÁËÌ ÌÙ Ý ÔÖ Ð ¾¼½¾

NS Ilist Clist F. F y<=w

Tensor. Field. Vector 2D Length. SI BG cgs. Tensor. Units. Template. DOFs u v. Distribution Functions. Domain

Ò ÓÛ Æ ØÛÓÖ Ð ÓÖ Ø Ñ ÓÖ ¹ ÙÐ Ö ÓÒ

A constraint based dependancy parser for Sanskrit

Ú Ò Ø ÐÝ ÒÖ Ò ÓÚ Ö Ø Ô Ø Ú Ö Ð Ý Ö Ò Ø Ï Ø Ö Ð Ø Ø Ø Ò º ÐØ ÓÙ Ø Ò ÐÝ ÓÛ Ø Ø Ø Ú Ö Ø ÓÒ Ò Ø Ô Ö ÔÓÒ ØÓ Ø Ô ÖØ Ð ÖÓÙÒ Ò ÙÒ ÓÖÑ ÓÒØ ÒÙ Ï Ó ÖÚ Ø ÓÒ Ö Ö ¹

Regression. Linear least squares. Support vector regression. increasing the dimensionality fitting polynomials to data over fitting regularization

38050 Povo (Trento), Italy Tel.: Fax: e mail: url:

ÅÓØ Ú Ø ÓÒ Ø Ú Øݹ ØÖ Ú Ð Ñ Ò ÑÓ Ð Ò Ô Ö ÓÒ Ð Þ ÖÚ ÓÒ Ñ ÖØÔ ÓÒ ¾» ¾

ÝØ Ð Ö Ø ÓÒ Ó ÝÒ Ñ ØÖ ÑÙÐ Ø ÓÒ Ó Ø Ú Ñ Ò Ð Ö Ø ÓÒ ÖÓÑ ØÖ ÓÙÒØ Ð Ð Ô Ö Ô Ø Ú Ø Ñ Ø ÓÒ Ó Ô Ø ÓÛ Ø ÛÓÖ Ø Ñ Ø ÓÒ Ó Ñ ÖÓ¹ ÑÙÐ Ø Ú ÓÖ ¾» ¾¾

function GENERAL-SEARCH( problem, strategy) returns a solution, or failure initialize the search tree using the initial state of problem loop do if

Metadata Stat-ahead DLD

Chapter 9. Trapezoidal Maps. 9.1 The Trapezoidal Map

t 2 3t + 2 lim xln x x x x2 + 1 x + 1

Comparison Sorts. EECS 2011 Prof. J. Elder - 1 -

x = x 1x 2 x (p-1)x x = 3 x = 3 x = 3 x = 3 0 x 1 x 2 x... (p-1)x

function GENERAL-SEARCH( problem, strategy) returns a solution, or failure initialize the search tree using the initial state of problem loop do if

Accept() Reject() Connect() Connect() Above Threshold. Threshold. Below Threshold. Connection A. Connection B. Time. Activity (cells/unit time) CAC

ÓÖ Ø ÁÒØ Ð ÔÖÓ ÓÖ Ñ Ðݺ Ê Ö Û ÒØ Ò Ò Ö Ð ÖÓÙÒ Ò Ñ Ð Ö ÔÖÓ Ö Ñ¹ Ñ Ò ÓÙÐ ÓÒ ÙÐØ ÔÔÖÓÔÖ Ø Ø ÜØ ÓÓ Ò ÓÒ ÙÒØ ÓÒ Û Ø Ø ÔÖÓ ÓÖ Ö Ö Ò Ñ Ò¹ Ù Ð ÔÙ Ð Ý ÁÒØ Ð Ò

Ì ÄÈ Ë ÈÖÓ Ð Ñ Ì ÄÈ Ë ÐÓÒ Ø Ô Ö Ñ Ø Ö Þ ÓÑÑÓÒ Ù ÕÙ Ò µ ÔÖÓ Ð Ñ Ò Ö Ð Þ Ø ÓÒ Ó Û ÐÐ ÒÓÛÒ Ä Ë ÔÖÓ Ð Ñ ÓÒØ Ò Ò Ô¹ÓÒ ØÖ ÒØ º Ò Ø ÓÒ ÁÒ ÄÈ Ë(,, Ã ½, Ã ¾, )

ÅÓ Ø Ü Ø Ò ÖÓ ¹ÓÚ Ö Ö ÓÙÖ ÔÖÓÚ ÓÒÐÝ ÐÐÓÛ Ö ÔÖ ÒØ Ø ÓÒ Ñ ÒØ ÇÚ ÖÚ Û ÛÓÖÐ ÔÔÐ Ø ÓÒ Ò Ö ÓÙÖ Û Ø Ö ÝÒØ Ø Ò ¹ Ê Ð Ö ÔÖ ÒØ Ø ÓÒ º Ñ ÒØ ÅÙ Ö Ö Ö ÔÖ ÒØ Ø ÓÒ Ö

ÇÙØÐ Ò Ó Ø Ø Ð ÅÓØ Ú Ø ÓÒ = ¾ ÙÔ Ö ÝÑÑ ØÖ Ò ¹Å ÐÐ ÕÙ ÒØÙÑ Ñ Ò ÆÙÑ Ö Ð Ð ÓÖ Ø Ñ Ò ÒÙÑ Ö Ð Ö ÙÐØ Ü Ø ÓÐÙØ ÓÒ ÙÖØ Ö Ô Ö Ô Ø Ú

ELA. Electronic Journal of Linear Algebra ISSN A publication of the International Linear Algebra Society Volume 13, pp , July 2005


Strong normalization of lambda-bar-mu-mu-tilde-calculus with explicit substitutions

Ö Ô ÓÒ Ø Ó ØÛÓ Ø Î Ò ÒÓØ Ý Î µº Ë Ø Î Ò Ø ÒÓÒ¹ ÑÔØÝ Ø Ó Ú ÖØ ÓÖ ÒÓ µ Ò Ø Ó Ô Ö Ó Ú ÖØ ÐÐ º Ï Ù Î µ Ò µ ØÓ Ö ÔÖ ÒØ Ø Ø Ó Ú ÖØ Ò Ò Ö Ô Ö Ô Ø Ú Ðݺ ÅÓÖ Ò

Lazy Semiring Neighbours

Verification. Lecture 3. Bernd Finkbeiner

¾ ÍÆ ÌÁÇÆ Ä ËÈ Á Á ÌÁÇÆ ÒÚ ÖÓÒÑ ÒØ ½ º½ ÓÖÑ Ø Ò º º º º º º º º º º º º º º º º º º º º º º º º ½ º½º½ Ö ØÓÖÝ ÒØÖ º º º º º º º º º º º º º º º º º º

How hard is it to control sequential elections via the agenda?

Ð Ò ØÓ ØØ Ö Ò ÔÔÖÓÜ Ñ Ð ØÝ Ö ÙÐغ Ì ÓÙÖ Ô Ö Ñ ØÓÛ Ö Ø Ø Ö Ò ÔÔÖÓÜ Ñ Ð ØÝ Ö ÙÐØ Ò Ô Ö Ý Ø Ô Ô Ö Ó È Ô Ñ ØÖ ÓÙ Ò Î ÑÔ Ð ÓÒ ÌÖ Ú Ð Ò Ë Ð Ñ Ò ÔÖÓ Ð Ñ µ Ø

Ö Ò ÁÅ ÔØ Ö Ê ÕÙ Ö ÔØ Ö ½¼ ½ Ò ½ º ÄÏÀ ØÓ ÖØ Ð ÁÒØ ÐÐ Ò ÁÒØÖÓ ÙØ ÓÒ ¹ ËÔÖ Ò ¾¼½ Ë º ÓÙ ÖÝ Ë Ù¹Û ¹Ö µ ÖØ ¼¾µ ¾¹ º º ÓÙ ÖÝ ½ ÁÒ ØÖÙØÓÖ³ ÒÓØ ÖÙ ÖÝ ½ ¾¼½

Liveness: The Readers / Writers Problem

Ï Ó ØÖ Ù ÛÓÖÐ Ý Ù Ð Ø Ö Ø ÓÖ Ð Ö Ð Ø Ú ØÓ Û ÆÈ ËÈ ÊË Ó ÓØ Ú ÓÑÔÐ Ø Ø º Å Ö ÌÓÖ ÅÌ Ú Ö Ð Ø Ú Þ Ð ÔÖÓÓ Ø Ø ÓÔØ Ñ Ð ÔÖÓÓ Ý Ø Ñ Ü Ø Ø ÆÈ ËÈ ÊË Ó Ú ÓÑÔÐ Ø

ν = fraction of red marbles

ÇÆÌ ÆÌ ËÙ Ø Ú ÒØÖÓ ÙØÓÖÝ Ö Ñ Ö Å Ø Ô ÓÖ Ò Ø Ú ÔÔÖÓ Ì Ô ÐÓ ÓÔ Ð Ö Ò À ÖÑ Ò ÙØ Ò Ø Ö Ð Ø ÓÒ Ô ØÓ Ò Ì ÒØ ÖÔÖ Ø Ò Ò Ø ÒØ ÖÔÖ Ø Ö Ò

Platform independent proc interface

½º ÌÖ ÙØÓÑØ

ÖÖ Ý ÒÑ ÒØ Ø Ø Ñ ÒØ Ö Ö ÓÖ ÒÝ Ð Ø¹ Ò Ð Ñ ÒØ Ö ØÓÖ º ÖÖ Ý ÓÖ Ù Ø ÓÒ Ó ÖÖ Ý Ò Ô Ý Ù Ò ØÖ ÔÐ Ø Ù Ö ÔØ º ØÖ ÔÐ Ø Ô Ö Ò Ò Ø ÓÖÑ ÐÓÛ Ö ÓÙÒ ÙÔÔ Ö ÓÙÒ ØÖ º Á

Optimized Lookahead Trees: Extensions to Large and Continuous Action Spaces

"unphysical region" pp e + e : FF modulus

ÇÙØÐÓÓ ÅÓØ Ú Ø ÓÒ ÀÓÑÓØÓÔÝ ÒÚ Ö Ò Ò Ò³ Ø ÓÖ Ñ ÓÒ ØÖÙØ ÓÒ Ó Ø Ð Ñ Ó ÙÒ Ú Ö Ð ÔÓÐÝÐÓ Ö Ø Ñ Ó Ú Ö Ð Ú Ö Ð ÁÒØ Ö Ø ÓÒ ÓÚ Ö ÝÒÑ Ò Ô Ö Ñ Ø Ö Ý Ù Ó Ñ

Computational Inelasticity FHLN05. Assignment A non-linear elasto-plastic problem

½ ÕÙ Ø ÓÒ ¾ ÔÔÖÓÜ Ñ Ø ÓÒ Ó ËØÖÓÒ ÓÒÚ Ö Ò Ó Ù Æ ØÓ Ù ËØÖÓÒ ÓÒÚ Ö Ò Ó Æ ØÓ ËØÖÓÒ ÓÒÚ Ö Ò Ó Ù Æ ØÓ Ù Ï ÓÒÚ Ö Ò Ó Ù Æ ØÓ Ù Ê ÙÐØ Ë Ø Ó Ø ÔÖÓÓ Ü ÑÔÐ Ì ½ ÜÔ

ÌÖ Ò Ò ÆÙÑ Ö ÓÖ È ÔÓ Ø Ö ÓÖ ÖÖÓÖ ÓÒØÖÓл ÔØ Ú Ñ Ò ³ ÁØ Ö Ø Ú Ô Ö ÐРе ÓÐÙØ ÓÒ ØÖ Ø ³ ÇÔ Ö ØÓÖ¹ ÔÐ ØØ Ò ÓÖ ÓÙÔÐ ÔÖÓ Ð Ñ ³ Ê ÙØ ÓÒ Ó ÒÙÑ Ö Ð ÓÑÔÐ Ü ØÝ

ÁÒØÖÓ ÙØ ÓÒ Ì Ñ Ñ Ö Ó Ú Ò Ô ÓÖ Ù Ô µ Ú Ø Ñ Ò Ö Ð ØÙÖ ÓÒ Ø Ö Ó Ø Ô ØØ ÖÒº ÀÓÛ Ú Ö Ò Ú Ù Ð Ò Ñ Ð Ø ÓÛÒ Ø ÒØ Ñ Ö Ò º Ì Ô ØØ ÖÒ Ö ÒÓØ Ø ÖÑ Ò Ò Ø ÐÐݺ Ì Ý

Extreme Values. Statistical Analysis Using R. Markov Processes and Applications. Markov Processes and Applications. Lee Fawcett David Walshaw

ÇÙØÐ Ò

j is the 2nd column in row i to contain a non zero: j = ja[ ia[i]+1 ] A[ i, j ] = a[ ia[i]+1 ] = 5

Ë Ò ÓÖ Æ ØÛÓÖ Å ÈÖÓØÓÓÐ ÂÙ Î Ð ÓÒ Ò Ä ÓÖ ØÓÖÝ ÓÖ Ì ÓÖ Ø Ð ÓÑÔÙØ Ö Ë Ò À Ð Ò ÍÒ Ú Ö ØÝ Ó Ì ÒÓÐÓ Ý ¾ º º¾¼¼ ÂÙ Î Ð ÓÒ Ò Ë Ò ÓÖ Æ ØÛÓÖ Å ÈÖÓØÓÓÐ

arxiv: v25 [math.ca] 21 Nov 2008

M 1 M 2 M 3 M 1 M 1 M 1 M 2 M 3 M 3

Reputation-Based Trust Management (extended abstract)

Communications Network Design: lecture 20 p.1/29

Ø Ñ Ò Ò ÙØÙÑÒ ¾¼¼¾ Ò Ò Ö ÕÙ ÒØ ÐÓ µ Ø Û Ø ØÖ ØÖÙØÙÖ ½ ȹØÖ È¹ ÖÓÛØ ÄÇË Ì È¹ØÖ Ø ØÖÙØÙÖ È¹ ÖÓÛØ Ð ÓÖ Ø Ñ ÓÖ Ò Ò ÐÐ Ö ÕÙ ÒØ Ø ÄÇË Ì Ð ÓÖ Ø Ñ ÓÖ Ò Ò Ö ÕÙ

ËÙÑÑ ÖÝ Ì Ó Ì Ó Ö Ä Ì ½ Ø ÏÊÅÁËË ÃÖ ÓÛ ÈÓÐ ¾¼¼ ¾» ½

ÇÙØÐ Ò Ó Ø Ð ÅÓØ Ú Ø ÓÒ ÔÓÐÝÒÓÑ Ð Ú ÓÒ ÒÓ Ò ÓÖ ÝÐ Ó ÙØÓÑÓÖÔ Ñ µ ÑÓ ÙÐ ÕÙ ¹ÝÐ µ ØÖÙ¹ ØÙÖ ÖĐÓ Ò Ö ÓÖ ÑÓ ÙÐ Ú ÐÙ Ø ÓÒ Ó ÖÓÑ ÓÖ Ö ÓÑ Ò Ò¹ ÐÙ Ò ÓÔÔ Ó µ Ü Ñ

Accounts(Anum, CId, BranchId, Balance) update Accounts set Balance = Balance * 1.05 where BranchId = 12345

¾ ÓÖÔÙ Ôк ÓÖÔÓÖ µ ÓÖÔÙ ÓÐÐ Ø ÓÒ Ó Ø ÜØ µ ÓÖ ÙØØ Ö Ò ½¼ Ø ÒÝ ½¼ Ö ÓÒ Ð ½¼ ½¾ ÙÖÖ ÒØ Ð Ð Ñ Ø ÓÖ ÙÒ ÒÒÓØ Ø Ø Ì ÑÓ Ø Ú ÐÙ Ð ÓÖÔÓÖ Ö Ø Ó Ø Ø ÓÙÖ Ò ØÙÖ ÐÐÝ

ÓÖØÖ Ò ÓÖØÖ Ò = ÜØ Ò ÓÒ ØÓ Ø ÆËÁ ÇÊÌÊ Æ Ø Ò Ö º Ê ÔÓÒ Ð ØÝ Ñ Ö Ò Æ Ø ÓÒ Ð ËØ Ò Ö ÁÒ Ø ØÙØ ÆËÁ  µ ÁÒØ ÖÒ Ø ÓÒ Ð ÇÖ Ò Þ Ø ÓÒ ÓÖ ËØ Ò Ö Þ Ø ÓÒ ÁËÇ»Á ÂÌ

ÇÚÖÚÛ ÏØ Õ Ñ ÏØ Ó Õ Ñ ÔÖÓÖÑ ÐÓÓ Ð Ë ÓÒ Ø ÍÐØÖËÈÊ ØÙÝ ¾

ÙÖ ¾ Ë Ð Ø ÔÔÐ Ø ÓÒ ¾ ¾

È Ö Ø ² ÑÔ Ö Ø Ò ÓÖÑ Ø ÓÒ ÓÖ Ñ È Ö Ø Ò ÓÖÑ Ø ÓÒ ÈÐ Ý Ö ÒÓÛ ÓÙØ Ø ÔÖ Ú ÓÙ ÑÓÚ Ó ÓÔÔÓÒ ÒØ º º º Ð ¹ËØ Û ÖØ Ñ º ÁÑÔ Ö Ø Ò ÓÖÑ Ø ÓÒ ÈÐ Ý Ö Ó ÒÓØ ÒÓÛ ÓÙØ Û


½º¾ Ò Ø ÓÒ Ì Ò Ó Ø ÓÚ ÕÙ Ø ÓÒ Ò ÓÖÑ Ð Þ Ý Ø ÓÐÐÓÛ Ò Ò Ø ÓÒº Ò Ø ÓÒ ½ È Ù Ó Ê Ò ÓÑ ÙÒØ ÓÒ Ñ Ðݵ Ñ ÐÝ ¾ ¼ ½ ¾Æ ÐÐ Ñ ÐÝ Ó Ð µ Ä µµ È Ù Ó Ê Ò ÓÑ ÙÒØ ÓÒ ¾

The Enigma machine. 1 Expert teams 25 mins. 2 Mixing the teams 30 mins. 3 Coding and decoding messages 1 period

Kevin Dowd, after his book High Performance Computing, O Reilly & Associates, Inc, 1991

Ã Ô ÐÐ Ø ÙÒ Ð ÕÙ Ô Ò ÙÖ ÓÑ Ú ÒØ Ö Ø ÓÒ Ò ÓÑÔ Ø Ø ÓÒ Ä ÙÖ Å ËËÁÇ ÄÈÌÅ ÍÒ Ú Ö Ø È Ö ÎÁ ¾½ ÒÓÚ Ñ Ö ¾¼½

½º Ò ÔÖÓÙÖ Ø Üµ ØØ ÖØÙÖÒ Ø Ø ÖÙÑÒØ ¼ ÓÖ ½ ÓØÖÛ º ÜÑÔÐ Ø ¼µ Ø Ø ½µ Ø Ø ¾µ Ø ³ µµ Ò Ø ÐÑ Üµ ÓÖ ÕÙÐ Ü ¼µ ÕÙÐ Ü ½µµµµ ¾

Ì ÓÑÔÙØ Ð Ñ Ò ÓÒ Ó ÌÖ Ó ÁÒ Ò Ø À Ø ÊÙ ÐÐ Å ÐÐ Ö ÂÙÐÝ ¾ ¾¼¼ Ì Ö Ø ÓÙÖ Ø ÓÒ Ó Ø ÖØ Ð ÔÔ Ö ÔØ Ö Ó È º º Ø Ø Ø ÍÒ Ú Ö ØÝ Ó Ó ÙÒ Ö Ø ÙÔ ÖÚ ÓÒ Ó ÊÓ ÖØ Áº ËÓ

CMD MDS Recovery DLD

Ø ÓÒº Ò ÑÔÓÖØ ÒØ «Ö Ò Ø Ø Û Ð Ò Ø ØÝÔ È Ò Ò Ö ØÖ ÖÝ ØÝÔ Ò Ö¹ÓÖ Ö ÐÓ ÙÖ ³ ÑÔÐ Ø ÓÖÝ Ó ØÝÔ µ È ÑÙ Ø ÑÔÐ ØÝÔ º ÐØ ÓÙ ØÝÔ ÒÐÙ Ø ØÝÔ Ó Ø ÑÔÐݹØÝÔ ¹ ÐÙÐÙ Ø

ËØÖÙØÙÖ ½ Î Ö ÐÙ Ø Ö ¹ Ò ÒØÖÓ ÙØ ÓÒ ¾ Ì Ø Ì ÈÙÞÞÐ Ì Á ÓÒÐÙ ÓÒ ÈÖÓ Ð Ñ Å Ö ¹ÄÙ ÈÓÔÔ ÍÒ Ä ÔÞ µ È Ö Ø È ÖØ ÔÐ ¾¼º¼ º½ ¾» ¾

ÇÙØÐ Ò ½ À ÙÒØ ÓÒ ¾ Ì ËÀ ¹ ÓÑÔ Ø Ø ÓÒ ÖÝÔØ Ò ÐÝ Ó À ÙÒØ ÓÒ ¾» ¾

Transcription:

Event Based Sequential Program Development: Application to Constructing a Pointer Program Jean-Raymond Abrial Consultant, Marseille, France jr@abrial.org Abstract. In this article, I present an event approach used to formally develop sequential programs. It is based on the formalism of Action Systems [6] (and Guarded Commands[7]), which is encoded within B [2]. This approach has already been used to develop distributed programs [4]. In the first part, I present the basic concepts. In the second part, I develop a complete example, which is a reshaping of the Shorr and Waite marking technique [1]. This algorithm is interesting because it involves a large number of pointer manipulations. 1 Introduction Sequential programs (e.g. loops), when formally constructed, are usually developed gradually by means of a series of progressively more refined sketches starting with the formal specification and ending in the final program. Each such sketch is already (although often in a highly non-deterministic form) a monolithic description which resumes the final intended program in terms of a single formula. This is precisely that initial formula, which is gradually transformed into the final program. It is argued here that this might not be the right approach. After all, in order to prove a large formula, a logician usually breaks it down into various pieces, on which he performs some simple manipulations before putting them again together in a final proof. We would like to experiment with such a paradigm and thus possibly decide whether it is applicable to construct programs as well. A sequential program is essentially made up of a number of individual assignments that are glued together by means of various constructs: sequential composition ( ), loop (WHILE) and condition (IF), whose rôle is to explicitly schedule these assignments in a proper order so that the execution of the program can achieve its intended goal. Here is an example of a sequential program where the various assignments have been emphasized: WHILE Ñ DO IF ½µ Ü ½ ELSIF ½ ½ ELSE Ô ½ ½ Û Ô ½ ½µ

The idea we want to explore here is to completely separate, during the design, these individual assignments from their scheduling. This approach is thus essentially one by which we favor an initial implicit distribution of computation over a centralized explicit one. At a certain stage, the program is just made of a number of naked guarded commands (which we call here events ), performing some actions under the control of certain guarding conditions. And at this point the synchronization of these events is not our concern. Thinking operationally, it is done implicitly by a hidden scheduler, which may fire an event once its guard holds. We can express as follows the various naked events corresponding to the previous example (the guard of each event is introduced by the keyword SELECT): SELECT Ñ ½µ Ü ½ SELECT Ñ ½µ Ü ½ ½ SELECT Ñ ½µ Ü ½ ½ Û Ô ½ ½µ SELECT Ñ Ô At the beginning of the development process, the event system is made of a single non-guarded event, which represents the specification of our future program. During the development process, other events might be added, which will be further refined together with the initial event. This is done in a certain disciplined manner as shown below. When all the individual pieces are on the table (this is the situation shown in the example), and only then, we start to be interested in their explicit scheduling. For this, we apply certain systematic rules whose rôle is to gradually merge the events and thus organize them into a single entity forming our final program. The application of these rules has the effect of gradually eliminating the various predicates making the guards. At the end of the development, it results in a single guardless final event (as the initial one). What is interesting about this approach is that it gives us full freedom to refine small pieces of the future program, and also to create new ones, without being disturbed by others : the program is developed by means of small independent parts that so remain until they are eventually put together systematically at the end of the process. The paper is organized in two parts. In the first one (section 2), the general framework of event systems is presented. In the second part (section 3) a complete example (inspired by the marking algorithm of Shorr and Waite) is presented. 2 Event System Concepts 2.1 Definition of an Event System: State and Events An event system is first made of a state, which is defined by means of constants and variables. In practical terms, these constants and variables mainly show simple mathematical objects: sets, binary relations, functions, numbers etc. Moreover, they are constrained by some conditions expressing the invariant properties of the system. Besides its state, an event system contains a number of events which show the way it may evolve. Each event is composed of a guard and an action. The guard is the necessary condition under which 2

the event may occur. The action, as its name indicates, determines the way in which the state variables are going to evolve when the event occurs. Once its guard holds, the occurrence of an event may be observed at any time (but may also never be observed). As soon as the guard does not hold however, the event cannot be observed. Events are atomic and when the guards of several events hold simultaneously then at most one of them may be observed. The choice of the elected event is non-deterministic. Practically speaking, an event, named xxx, is presented in one of the two following simple forms: xxx SELECT È µ Ë µ xxx BEGIN Ë µ where È µ is a predicate denoting the guard, and Ë µ is the action. The list denotes some constants and variables of the state. Sometimes, the guard is simply missing and the event may thus take place at any time (this corresponds to the second form shown). The action presents itself in the form of a simultaneous assignment of certain state variables by certain expressions. Such expressions depend upon the state. It is to be noted that those variables which are not mentioned in the list do not change. Such an action can be first written in one of the following two simple equivalent forms: There exists however a more general form of action, which is the following: ANY Ü Ý WHERE É Ü Ý µ Ë Ü Ý µ where the identifiers Ü Ý denotes some constants that are local to the event. These constants are constrained by the predicate É Ü Ý µ. The formula Ë Ü Ý µ denotes a simple deterministic action as above (multiple assignment). Notice that this non-deterministic action must be feasible. In other words, under the guard of the event, the following must hold: Ü Ý µ É Ü Ý µ 2.2 Consistency of an Event System Once a system is built, one must prove that it is consistent. This is done by proving that each event of the system preserves the invariant. More precisely, it must be proved that the action associated to each event modifies the state variables in such a way that the corresponding new invariant holds under the hypothesis of the former invariant and of the guard of the event. For a system with state variable Ú, invariant Á Úµ, and an event of the form indicated on the left, the statement to be proved is the one indicated on the right: SELECT È Úµ Ú Úµ Á Úµ È Úµ µ Á Úµµ 3

2.3 Refining an Event System Refining an event system consists of refining its state and its events. A concrete system (with regards to a more abstract one) has a state that should be related to that of the abstraction through a, so-called, abstraction relation, which is expressed in terms of an invariant Â Ú Ûµ connecting the abstract state represented by the variables Ú and the concrete state represented by the variables Û. Each event of the abstract model is refined to one or more corresponding events of the concrete one. Informally speaking, a concrete event is said to refine its abstraction (1) when the guard of the former is stronger than that of the latter (guard strengthening), (2) and when the connecting invariant is preserved by the conjoined action of both events. In the case of an abstract event (left) and a corresponding concrete event (right) having the forms SELECT È Úµ Ú Úµ SELECT É Ûµ Û Ûµ then the statement to prove is the following (where Á Úµ is the abstract invariant and Â Ú Ûµ is the connecting invariant): Á Úµ Â Ú Ûµ É Ûµ µ È Úµ  ڵ Ûµµ Moreover, the concrete system must not deadlock more often than the abstract one. This is proved by stating that the disjunction of the abstract guards implies that of the concrete ones, formally: Á Úµ Â Ú Ûµ È ½ Úµ È Ò Úµµ µ É ½ Ûµ É Ò Ûµ where the È and É denote the abstract and concrete guards respectively. Note that this statement could be split into Ò distinct statements. 2.4 Adding New Events in a Refinement When refining an event system by another one, it is possible to add new events. Such events must be proved to refine the dummy event which does nothing (skip) in the abstraction. Moreover, a special proof must be performed, ensuring that the new events cannot collectively take control for ever. For this, a unique variant expression must be decreased by each new event. In the case of a new event of the following form: SELECT Ê Ûµ Û Ûµ the following statement has thus to be proved: Á Úµ Â Ú Ûµ µ Î Ûµ ¾ Æ Á Úµ È Úµ Â Ú Ûµ µ Â Ú Ûµµ Î Ûµµ Î Ûµ where Î Ûµ denotes the variant expression considered (here it is a natural number expression, but it can be more elaborate). 4

2.5 Special Properties of the Event System Used to Develop Sequential Programs In this section, we shall express the specific properties that an event system used for sequential program development should satisfy. We shall also fix the style we shall adopt in our future program development. (1) At the beginning of a development, our event system is first characterized by some Ô Ö Ñ Ø Ö, say Ô, which denote some constant input of the future program. In other words they will not evolve when the future program is run. The constant Ô are declared as follows: Ô ¾ Ë Ô È Ö _ÓÒ Ø ÓÒ Ôµ where Ë Ô denotes the type of the parameters and È Ö _ÓÒ Ø ÓÒ Ôµ denotes a predicate defining a certain condition, which the Ô Ö Ñ Ø Ö should satisfy (besides typing, of course). The initial system also has some variables, called here Ö ÙÐØ. These variables are typed with Ë Ö as follows: Ö ÙÐØ ¾ Ë Ö The initial event system contains only one event that can be fired any time: its guard is simply missing (hence it always holds). It involves the Ö ÙÐØ and describes the characteristic properties of the outcome of the future program. Here is the most general form of this event: aprog BEGIN ANY Ö WHERE Ö ¾ Ë Ö È Ó Ø_ÓÒ Ø ÓÒ Ô Öµ Ö ÙÐØ Ö where Ë Ö denotes the type of the Ö ÙÐØ and È Ó Ø_ÓÒ Ø ÓÒ Ô Öµ denotes the final condition, which the program should satisfy. This condition involves the parameters Ô as well as the Ö ÙÐØ Ö. The pre- and post- conditions together represent the specification of our program. Notice that the initial system must contain another special event called init, which allows the initial value of Ö ÙÐØ to freely float within its type as follows 1 ; init BEGIN Ö ÙÐØ ¾ Ë Ö (2) During the development, we perform various refinements of the initial event system. As a consequence, at each stage of the development, the current event system may contain more variables and more events. (3) At the end of the development, and after applying some merging rules defined in the next section, one should obtain again a single event of the following form: cprog BEGIN ÁÒ Ø Ð Ø ÓÒ È ÖÓ Ö Ñ 1 The construct Ü ¾ is a shorthand for ANY Ý WHERE Ý ¾ Ü Ý. 5

where ÁÒ Ø Ð Ø ÓÒ corresponds to the last version of init and È ÖÓ Ö Ñ is the last version of aprog. 2.6 Merging Rules We essentially have two merging rules, one for defining a conditional statement and the other one for defining a loop statement. Here are these rules: SELECT È É Ë SELECT È É Ì SELECT È IF É Ë ELSE Ì SELECT È É Ë SELECT È É Ì SELECT È WHILE É DO Ë Ì These rules can be read as follows: if we have an event system where two events have forms corresponding to the ones shown in the antecedent of the rule, they can be merged into a single event corresponding to the consequent of the rule. Notice that both rules have the same antecedentevents, so that the application of one or the other might be problematic. There is no confusion however as the rules have some incompatible side conditions: The second rule (that introducing WHILE) requires that the first antecedent event (that giving rise to the body Ë of the loop) appears at one refinement level below that of the second one. In this way, we are certain that there exists a variant ensuring that the loop terminates (see section 2.4). Moreover, the first event must keep the common condition È invariant. The merging event is considered to appear at the same level as the second antecedent event. The first rule (that introducing IF) is applicable when the second one is not. The merging event is considered to bear the same level as the smallest one. When the two merged events are not at the same level, the merged variant becomes the pair of both variants, which thus decreases lexicographically. Note that in both rules, the common guard È is optional. If missing, the application of the rule results in a non-guarded event. The first rule may take a special form when one of the antecedent events has an IF form. It goes as follows: SELECT È É Ë SELECT È É IF Ê Ì ELSE Í SELECT È IF É Ë ELSIF Ê Ì ELSE Í 3 Example The example we present in this section is inspired by the marking algorithm of Shorr and Waite. This algorithm has received a considerable attention in the literature, so that it is impossible to cite 6

all references on the subject (a recent and interesting one is that of R. Bornat [5]). Given a graph and a certain point in it (called the top ), the marking algorithm computes the image of this point under the transitive closure of the relation defining the graph. Informally, this algorithm is characterized by three properties: 1. It is is a graph traversal algorithm from the top. 2. The traversal is depth-first. 3. The backtracking structure is stored within the graph itself. 3.1 A One Shot Specification Let the graph be defined by a constant binary relation built on a set Æ of nodes. Let be the transitive closure of (the required properties of will appear in the next section). Let Ø be any node. The result Ö is a subset of Æ. The event mark computes in one shot the image of Ø under. Fig.1 shows this marking performed in one shot 2. Constants ¾ Æ Æ ¾ Æ Æ Ø ¾ Æ Invariant Ö Æ Events Ò Ø BEGIN Ö ¾ È Æ µ Ñ Ö BEGIN Ö Ø t Fig.1. Marking in one shot 3.2 Refinement 1: A Non-deterministic Loop In this refinement, we introduce a new variables (for black ), which is a set of nodes, and a new event called prg1 (for progress1 ). The image of the set Ø under the transitive closure is now computed gradually. The node Ø is supposed to be in, and the set is supposed to be included in Ø. It is set to the singleton Ø in the init event 3. The guard of event prg1 states that is not empty. An element Ý of this set is thus chosen arbitrarily and put into the set. The event mark is now guarded by the condition : in this case the closure Ø is exactly equal to the set. Fig.2 shows an animation of this non-deterministic algorithm. 2 The main set-theoretic notations are summarized in the Appendix. 3 In the event init, we have removed the initialisation of Ö in order to ease the reading. 7

Events Invariant Æ Ø ¾ Ø Ò Ø BEGIN Ø ÔÖ ½ SELECT ANY Ý WHERE Ý ¾ Ý Ñ Ö SELECT Ö In order to validate this refinement, we mainly need to prove that (1) the initialisation establishes the invariant Ø, (2) the event prg1 maintains it, and (3) the concrete version of event mark refines its abstraction. After some elementary transformations, these amount to proving respectively: To be proved Ø Ø Ü Ý ¾ Ü ¾ Ø µ Ý ¾ Ø Ø ¾ Ø µ Ø For proving this, we only need the following well known properties of the closure of : Properties of closure Æ µ µ Ü Ýµ Æ Ü Ý ¾ Ü ¾ µ Ý ¾ µ Æ µ µ We also need to prove that (1) event prg1 refines skip (obvious since it only involves the new variable ), (2) the event system does not deadlock as the abstraction does not (obvious since the disjunction of the guards of prg1 and mark is clearly true), and (3) that the event prg1 decreases some natural number quantity (take the cardinality of the set Æ ). 8

01 01 01 Fig.2. A non-deterministic marking algorithm 3.3 Refinement 2: Making the Loop More Deterministic (Depth-first Marking) This refinement contains the first key decision of the development. The idea is to constrain the previous non-deterministic algorithm to always move more deeply in the graph until one encounters either a terminal node or some previously encountered nodes. At this point, the algorithm backtracks to the previously visited node, and from there continues to explore the graph if possible, and so on. Note that there remains some non-determinacy in this algorithm as the choice of the branch to follow in a node is arbitrary. We introduce three variables in this refinement: First a, so-called, current pointer Ô. It always corresponds to a black node, from which we move to a deeper node in the graph. Initially Ô is set to the top node Ø. The second variable is a, so-called, backtracking structure. It allows one to make Ô revisit the previous node when it cannot pursue further its depth-first graph traversal. The backtracking structure has some interesting properties as shown in Fig.3: it is an injective function, it is made of black nodes only, its domain extended with Ø is exactly its range extended with Ô, it has no cycle, and, when reversed, it is included in the graph. Moreover, if we consider the image under of the black nodes that are not in the backtracking structure, this image is made of black nodes only. The third variable is a boolean Ò which is used to detect the end of the loop. When equal to ÇÃ then is included in. p t Fig.3. The backtracking Structure Ô ¾ Invariant ¾ Ô µ Ø Ø µ Ô 9

ÓÑ µ Ø Ö Ò µ Ô ÓÑ µ Ø Ø ¾ ½ µ ÓÑ µ Ø µ ½ ÓÑ µ Ø µ Ò ¾ ÇÃ ÃÇ Ò ÇÃ µ Two new events are introduced: prg2 and prg3. Event prg2 is doing the backtracking and event prg3 is detecting the end of the loop (when Ô is equal to Ø and when there are no further nodes to explore from Ø). These events must decrease some natural number quantity (take the cardinality of augmented with the encoding of Ò: 1 when ÃÇ, 0 when ÇÃ). Here are the events of this refinement: Events Ò Ø BEGIN Ô Ò Ø Ø ÃÇ ÔÖ ½ SELECT Ò ÃÇ Ô ANY Ý WHERE Ý ¾ Ô Ô Ý Ý Ý Ô ÔÖ ¾ SELECT Ò ÃÇ Ô Ô Ø Ô Ôµ Ô ÔÖ SELECT Ò ÃÇ Ô Ô Ø Ò ÇÃ Ñ Ö SELECT Ò ÇÃ Ö At this point, it might be interesting to apply the merging rules, just to have an idea of the abstract program we could obtain. Merging events prg2 and prg3 leads to the following: ÔÖ ¾_ SELECT Ò ÃÇ Ô IF Ô Ø Ô Ôµ Ô ELSE Ò ÇÃ Now merging events prg1 and prg2_3 leads to the following (note that the WHILE merging rule is not applicable here since event prg2_3, which could be a potential candidate for the loop body since it appears one level below that of prg1, prg2_3 does not keep invariant the common guard Ò ÃÇ): 10

ÔÖ ½_¾_ SELECT Ò ÃÇ IF Ô ANY Ý WHERE Ý ¾ Ô ELSIF Õ Ø Ô Ôµ Ô ELSE Ò ÇÃ Ô Ý Ý Ý Ô Merging finally events mark and prg1_2_3 leads to the following (we have no problem here applying the WHILE loop since there is no common remaining guard): Ñ Ö _ÔÖ ½_¾_ WHILE Ò ÃÇ DO IF Ô ANY Ý WHERE Ý ¾ Ô ELSIF Õ Ø Ô Ôµ Ô ELSE Ò ÇÃ Ô Ý Ý Ý Ô Ö By adding the init event, we obtain the following abstract program: Ô Ò Ø Ø ÃÇ WHILE Ò ÃÇ DO IF Ô ANY Ý WHERE Ý ¾ Ô ELSIF Õ Ø Ô Ôµ Ô ELSE Ò ÇÃ Ô Ý Ý Ý Ô Ö In Fig.4, you can see an animation of this abstract algorithm. Notice the current pointer (emphasized in grey, but it is also black!) and the backtracking structure situated next to the pointers forming the graph. 11

01 01 Fig.4. A depth-first marking with backtracking structure and current point 3.4 Refinement 3: Specializing the Graph by Means of Two Partial Functions In this refinement, we refine the constant relation by two constant partial functions called ÐØ (for left ) and ÖØ (for right ). There are no changes in the variables. The event prg1 is refined by two events prg11 and prg12. They correspond to a left or right descent respectively. The algorithm is now completely deterministic: one first tries to move down along the left path then along the right one. Fig.5. shows an animation of this algorithm (we have represented the left arrows in white and the right ones in black). Events Ò Ø BEGIN Ô Ò Ø Ø ÃÇ ÔÖ ½½ ÔÖ ½¾ SELECT Ò ÃÇ ÐØ Ô Ô ÐØ Ôµ ÐØ Ôµ ÐØ Ôµ Ô SELECT Ò ÃÇ ÐØ Ô ÖØ Ô ÔÖ ¾ SELECT Ò ÃÇ Ô Ô Ø Ô Ôµ Ô ÔÖ SELECT Ò ÃÇ Ô Ô Ø Ò ÇÃ Ñ Ö SELECT Ò ÇÃ Ö 12

01 01 Fig.5. Adding left and right pointers 3.5 Refinement 4: Decorating the Nodes of the Backtracking Structure In this refinement we decorate each node of the range of the backtracking structure (thus Ô is not decorated). The intent of decorating a node is to record the fact that the path followed by the algorithm from that node was the left or the right one. On Fig.6 you can see that some nodes of the range of are decorated with l (for left) and another one with r (for right). When the decoration is l, it means that the algorithm has chosen the left pointer in doing further visits from this node, and similarly for the other direction. We have painted in white or black the pointer of the backtracking structure whose initial node is decorated l or r respectively. p l r l l t Fig.6. Decorating the nodes (except first) and pointers (except first) of the backtracking structure We introduce two variables, called Ð Ø and Ö Ø, corresponding to the sets of decorated nodes. These sets form a partition of the range of. Moreover by reversing a pointer of which is ending in a node of Ð Ø we obtain a pointer of ÐØ and similarly for the other direction. These properties are formalized in the following table: 13

Invariant Ð Ø Æ Ö Ø Æ Ð Ø Ö Ø Ö Ò µ Invariant Ð Ø Ö Ø Ð Ø ½ ÐØ Ö Ø ½ ÖØ 01 01 01 Fig.7. Decorating the backtracking structure The event prg2 is refined by two events prg21 and prg22. They correspond to a left or right backtracking respectively. Here are the events of this refinement: Events Ò Ø BEGIN Ô Ò Ð Ø Ö Ø Ø Ø ÃÇ ÔÖ ½½ ÔÖ ½¾ SELECT Ò ÃÇ ÐØ Ô Ô Ð Ø ÐØ Ôµ ÐØ Ôµ ÐØ Ôµ Ô Ð Ø Ô 14

ÔÖ ¾½ SELECT Ò ÃÇ Ô Ô Ø Ôµ ¾ Ð Ø Ô Ð Ø Ôµ Ô Ð Ø Ôµ ÔÖ ¾¾ ÔÖ SELECT Ò ÃÇ Ô Ô Ø Ò ÇÃ Ñ Ö SELECT Ò ÇÃ Ö 3.6 Refinement 5: Storing Part of Backtracking Structure Within the Graph This refinement contains the second key decision of the development. This is the main idea of the Schorr and Waite paper: it consists in storing the backtracking structure in the graph itself, which is thus modified during the execution but recovers its initial setting at the end of it. For this, we introduce two new variables called ÙÐØ and ÙÖØ. They represent the dynamic left and right pointers of the graph. The backtracking structure is now almost stored in ÙÐØ and ÙÖØ, almost because there remains the pair Ô Ôµ, which, when it exists, cannot be stored in the graph. For this, we define a new variable called : it is a mini-function which is either empty or contains a single pair. Here are the definitions and properties of these variables: Invariant ÙÐØ ¾ Æ Æ ÙÖØ ¾ Æ Æ ¾ Æ Æ Invariant ÙÐØ Ð Ø ÐØ Ð Ø ÙÖØ Ö Ø ÖØ Ö Ø Ô Events Ò Ø BEGIN Ô Ò Ð Ø Ö Ø ÙÐØ ÙÖØ Ø Ø ÃÇ ÐØ ÖØ ÔÖ ½½ ÔÖ ½¾ SELECT Ò ÃÇ ÙÐØ Ô Ô Ð Ø ÙÐØ ÙÐØ Ôµ ÙÐØ Ôµ Ô ÙÐص ½ Ð Ø Ô Ô ÙÐØ 15

ÔÖ ¾½ SELECT Ò ÃÇ ÙÐØ ÙÖص Ô Ô Ø Ôµ ¾ Ð Ø Ô Ð Ø Ôµ Ôµ ÙÐØ Ð Ø Ôµ ÙÐØ Ôµµ Ô ÔÖ ¾¾ ÔÖ SELECT Ò ÃÇ ÙÐØ ÙÖص Ô Ô Ø Ò ÇÃ Ñ Ö SELECT Ò ÇÃ Ö 01 01 01 Fig.8. Storing part of the backtracking structure within the graph (the remaining part is emphasized) 3.7 Refinement 6: Introducing the Dummy Node nil and a Second Current Pointer In this refinement, we implement the mini-function which, when non-empty, is made of a unique pair starting in Ô. The implementation is done by means of a second sub-current pointer Õ. In fact, when it is empty, then Ô is situated at the top, Ø. In order to implement the pair Ô Ôµ even at the point Ø, we have no choice but introducing a dummy node, called Ò Ð. This is the purpose of this refinement. 16

This leads to a simple modification of the dynamic pointers ÙÐØ and ÙÖØ, which becomes ÚÐØ and ÚÖØ. The new pointer is called Õ. Here are the formal definitions and properties of these new variables: Constants Ò Ð ¾ Æ Ò Ð ¾ ÓÑ Ðص ÓÑ Öص Ò Ð ¾ Ö Ò Ðص Ö Ò Öص Ø Ò Ð Invariant ÚÐØ ¾ Æ Æ ÚÖØ ¾ Æ Æ Õ ¾ Æ Invariant ÚÐØ ÙÐØ Ð Ø Ø Ò Ð µ ÚÖØ ÙÖØ Ö Ø Ø Ò Ð µ Ô Ø µ Õ Ò Ð Ô Ø µ Õ Øµ Events Ò Ø BEGIN Ô Õ Ò Ð Ø Ö Ø ÚÐØ ÚÖØ Ø Ø Ò Ð ÃÇ ÐØ ÖØ ÔÖ ½½ SELECT Ò ÃÇ ÚÐØ Ô Ô Õ Ð Ø ÚÐØ Ôµ ÚÐØ Ôµ Ô Ð Ø Ô ÚÐØ Ôµ Õ ÔÖ ½¾ ÔÖ ¾½ SELECT Ò ÃÇ ÚÐØ ÚÖص Ô Ô Ø Õ ¾ Ð Ø Ô Õ Ð Ø Õ ÚÐØ Õµ Ð Ø Õ ÚÐØ Õµ Ô ÔÖ ¾¾ ÔÖ SELECT Ò ÃÇ ÚÐØ ÚÖص Ô Ô Ø Ò ÇÃ Ñ Ö SELECT Ò ÇÃ Ö 3.8 Refinement 7: Making the Graph Functions Total In this refinement we are making the two functions ÚÐØ and ÚÖØ total by introducing Ò Ð as a dummy value when they are not defined. For this we define two new constants ÐØÔ and ÖØÔ and two new variables ÛÐØ and ÛÖØ. They are as follows: 17

Constants ÐØÔ ¾ Æ Æ ÖØÔ ¾ Æ Æ ÐØÔ Æ Ò Ð µ ÐØ ÖØÔ Æ Ò Ð ÖØ Invariant ÛÐØ ¾ Æ Æ ÛÖØ ¾ Æ Æ ÛÐØ Æ Ò Ð µ ÚÐØ ÛÖØ Æ Ò Ð ÚÖØ Ò Ø BEGIN Ô Õ Ò Ð Ø Ö Ø ÛÐØ ÛÖØ Ø Ø Ò Ð ÃÇ ÐØÔ ÖØÔ ÔÖ ½½ ÔÖ ½¾ SELECT Ò ÃÇ ÛÐØ Ôµ Ò Ð ÛÐØ Ôµ ¾ Ô Õ Ð Ø ÛÐØ Ôµ ÛÐØ Ôµ Ô Ð Ø Ô ÛÐØ Ôµ Õ ÔÖ ¾½ SELECT Ò ÃÇ ÛÐØ Ôµ Ò Ð ÛÐØ Ôµ ¾ µ ÛÖØ Ôµ Ò Ð ÛÖØ Ôµ ¾ µ Ô Ø Õ ¾ Ð Ø Ô Õ Ð Ø Õ ÛÐØ Õµ Ð Ø Õ ÛÐØ Õµ Ô ÔÖ ¾¾ ÔÖ SELECT Ò ÃÇ ÛÐØ Ôµ Ò Ð ÛÐØ Ôµ ¾ µ ÛÖØ Ôµ Ò Ð ÛÖØ Ôµ ¾ µ Ô Ø Ò ÇÃ Ñ Ö SELECT Ò ÇÃ Ö 3.9 Refinement 8: Introducing Color and Direction In this last refinement we encode the sets, Ð Ø and Ö Ø. The first one,, is encoded by means of a total function ÐÖ capable of taking two values, namely Ä Ã and Ï ÀÁÌ. The second and third sets are together encoded by means of a total function Ö capable of taking two values, namely Ä Ì and ÊÁ ÀÌ. The verification of this refinement requires to prove that the pointer Õ is either in the set Ð Ø or in the set Ö Ø. Here are the definitions of these new variables: 18

Invariant ÐÖ ¾ ÆÇ Ä Ã Ï ÀÁÌ Ö ¾ ÆÇ Ä Ì ÊÁ ÀÌ Invariant ÐÖ ½ Ä Ã Ð Ø Ö ½ Ä Ì Ö Ø Ö ½ ÊÁ ÀÌ Ò Ø BEGIN Ô Õ Ò Ø Ò Ð ÃÇ ÐÖ Øµ Ä Ã ÔÖ ½½ ÔÖ ½¾ SELECT Ò ÃÇ ÛÐØ Ôµ Ò Ð ÐÖ ÛÐØ Ôµµ Ï ÀÁÌ ÐÖ ÛÐØ Ôµµ Ä Ã Ô Õ ÛÐØ Ôµ Ô Ö Ôµ Ä Ì ÛÐØ Ôµ Õ SELECT Ò ÃÇ ÛÐØ Ôµ Ò Ð ÐÖ ÛÐØ Ôµµ Ï ÀÁÌ µ ÛÖØ Ôµ Ò Ð ÐÖ ÛÖØ Ôµµ Ï ÀÁÌ ÐÖ ÛÖØ Ôµµ Ä Ã Ô Õ ÛÖØ Ôµ Ô Ö Ôµ ÊÁ ÀÌ ÛÖØ Ôµ Õ ÔÖ ¾½ SELECT Ò ÃÇ ÛÐØ Ôµ Ò Ð ÐÖ ÛÐØ Ôµµ Ï ÀÁÌ µ ÛÖØ Ôµ Ò Ð ÐÖ ÛÖØ Ôµµ Ï ÀÁÌ µ Ô Ø Õ ¾ Ð Ø Ô Õ Õ ÛÐØ Õµ ÛÐØ Õµ Ô ÔÖ ¾¾ SELECT Ò ÃÇ ÛÐØ Ôµ Ò Ð ÐÖ ÛÐØ Ôµµ Ï ÀÁÌ µ ÛÖØ Ôµ Ò Ð ÐÖ ÛÖØ Ôµµ Ï ÀÁÌ µ Ô Ø Õ ¾ Ð Ø Ô Õ Õ ÛÖØ Õµ ÛÖØ Õµ Ô ÔÖ SELECT Ò ÃÇ ÛÐØ Ôµ Ò Ð ÐÖ ÛÐØ Ôµµ Ï ÀÁÌ µ ÛÖØ Ôµ Ò Ð ÐÖ ÛÖØ Ôµµ Ï ÀÁÌ µ Ô Ø Ò ÇÃ Ñ Ö SELECT Ò ÇÃ Ö ÐÖ ½ Ä Ã 19

3.10 Obtaining the Final Program Applying the merging rules in very much the same way as we have done it in section 3.3, leads to the following program. Note that we have not mentioned the mark event at the end of the program since our final purpose is just to change the colors of the relevant nodes. Also note that this program needs a few more obvious transformations in order to remove the various occurrences of the operators and replace them by. This would require the introduction of some local variables, and can be done on a purely syntactic basis. Ô Õ Ò Ø Ò Ð ÃÇ ÐÖ Øµ Ä Ã WHILE Ò ÃÇ DO IF ÛÐØ Ôµ Ò Ð ÐÖ ÛÐØ Ôµµ Ï ÀÁÌ ÐÖ ÛÐØ Ôµµ Ä Ã Ô Õ ÛÐØ Ôµ Ô Ö Ôµ Ä Ì ÛÐØ Ôµ Õ ELSIF ÛÖØ Ôµ Ò Ð ÐÖ ÛÖØ Ôµµ Ï ÀÁÌ ÐÖ ÛÖØ Ôµµ Ä Ã Ô Õ ÛÖØ Ôµ Ô Ö Ôµ ÊÁ ÀÌ ÛÖØ Ôµ Õ ELSIF Ô Ø IF Ö Õµ Ä Ì ELSE Ô Õ Õ ÛÐØ Õµ ÛÐØ Õµ Ô Ô Õ Õ ÛÖØ Õµ ÛÖØ Õµ Ô ELSE Ò Çà As can be seen, this algorithm is very symmetric with respect to the left and right directions. This was not the case with the original Schorr and Waite algorithm. An interesting outcome of the algorithm presented here is that it seems more efficient than the original one, where each marked node is visited three times. Here each marked node is visited once plus the number of out-going pointers leading to genuine nodes that are not already marked. In the example shown, where we have five marked nodes, the original algorithm takes 15 iterations, whereas the one presented here takes only 9 iterations: two nodes are visited three times and three nodes are visited only once. 3.11 About Proofs The development has been entirely proven with Atelier B [8], the tool associated with the B Method. In the following table, the statistical details of these proofs can be seen. It shows that approximatively 70% of the proofs are done automatically. The interactive proofs have all been done with the new interface, Click n Prove [3], which has recently been developed for Atelier B. Most of them are simple. A few of them, however, are 20

technically (not mathematically) slightly more difficult. You can observe that, by the end of the development a larger proportion of proofs have to be done interactively: this is essentially due to the growing presence of useless hypotheses, which induce some noise and thus make the automatic prover less efficient. The interaction then essentially consists of reducing the number of relevant hypotheses and then launching the automatic prover. Refinement Steps Automatic Interactive Total 1. Non-deterministic Traversal ½ 2. Depth-First Traversal ¾ ¾ 3. Introducing Left and Right Partial Functions ¼ 4. Decorating the Backtracking Structure ½ ½ ½ 5. Storing the Backtracking Structure ¾ ¾ 6. Introducing nil and the Second Pointer ½¼ ½½ ¾½ 7. Making Left and Right Functions Total ¾ ½ ¾ 8. Introducing Colors and Directions ½¾ ½½ ¾ TOTAL ½¼ ½ 4 Conclusion We have presented an event-based approach to the development of sequential programs, and we have demonstrated it on a well-known non-trivial pointer program: the Schorr-Waite marking algorithm. Contrary to what is done usually, rather than proving it directly, we formally develop this program by means of a number of successive refinement steps. Note that the first two objectives of the Schorr- Waite algorithm (namely graph traversal from top and depth-first traversal) are reached after the first and second refinements, whereas the third one (storing the backtracking function in the graph) is obtained after the 5th and 6th refinements. Acknowledgements I would like to warmly thank D. Cansell and W. Stoddart for their very careful reading of this text. References 1. H. Schorr and W.M. Waite. An Efficient Machine-Independent Procedure for Garbage Collection in Various List Structures. CACM Aug 1967 2. J.R. Abrial. The B-Book - Assigning Programs to Meanings. Cambridge University Press, 1996. 3. J.R. Abrial and D. Cansell Click n Prove: Interactive Proofs Within Set Theory TPHOLs 2003. 21

4. J.R. Abrial, D. Cansell and D. Méry A Mechanically Proved and Incremental Development of IEEE Tree Identify Protocol Formal Aspect of Computing 14. 2003 5. R. Bornat. Proving Pointer Programs in Hoare Logic. In R. Backhouse and J. Oliveira, editors, Mathematics of Program Construction (MPC 2000), LNCS 1837. Springer-Varlag, 2000. 6. R.J.R Back and R. Kurki-Suonio. Decentralization of Process Nets with Centralized Control 2nd ACM SIGACT-SIGOPS Symposium on Principles of Distributed Computing. 1983. 7. E.W. Dijkstra A Discipline of Programming Prentice-Hall. 1976. 8. Clearsy ATELIER B. User Manual. Aix-en-Provence. 2001. Appendix: Summary of Notations Notation Meaning È µ Set of subsets of s Ø Cartesian product of and Ø Ø Set of binary relations from to Ø. Same as È Øµ Ö Image of set under binary relation Ö Ø Set of partial functions from to Ø Ø Set of partial injections from to Ø. Same as ص Ø µ Ö Binary relation Ö reduced to pairs starting in set Ö Binary relation Ö reduced to pairs not starting in set ܵ Ý The pair made of and Relation overridden by relation. Same as ÓÑ µ µ Same as Ü Ý 22