4 r i an approach to structuring for the vdm
play

4> . -r' ' ; ( , i ~ An Approach to Structuring for the - PowerPoint PPT Presentation

4> . -r' ' ; ( , i ~ An Approach to Structuring for the VDM Specification Language Stephen Bear Fli;' HEWLETT HPLABS - INFORMATION SYSTEMS CENTRE SOFTWARE ENGINEERING DEPARTMENT PACKARD ~ REQUIREMENTS Allow a large


  1. · 4> . -r' ' ; ( , i

  2. ~ An Approach to Structuring for the VDM Specification Language Stephen Bear Fli;' HEWLETT HPLABS - INFORMATION SYSTEMS CENTRE SOFTWARE ENGINEERING DEPARTMENT PACKARD

  3. ~ REQUIREMENTS • Allow a large specification to be split into person sized units, in a natural way. • Allow an individual module, or an incomplete group of modules to be checked. • Limit interference between separate units. • Provide a detailed semantic definition SB31 Fli;- HEWLETT HPLABS - INFORMATION SYSTEMS CENTRE PACKARD SOFTWARE ENGINEERING DEPARTMENT

  4. ~ CONSTRAINTS • It must be possible to compare the semantics of a specification given in the core language with the semantics of a specification given using the structuring constructs. - so we use the same basic mathematical machinery. • The definition of the structuring constructs must preserve the semantics of the core language. - so we do not extend the core language. SB32 Flin- HEWLETT HPLABS - INFORMATION SYSTEMS CENTRE PACKARD SOFTWARE ENGINEERING DEPARTMENT

  5. ~ A CHOICE • Use simple unsophisticated mathematics S868 Flin- HEWLETT HPLABS - INFORMATION SYSTEMS CENTRE PACKARD SOFTWARE ENGINEERING DEPARTMENT

  6. ~ OVERVIEW OF MODULES • As in STC VDM, the basic specification unit is a MODULE. • A module encapsulates a collection of related types, values, functions and operations. • Operations within a module may interact by updating values of a shared state. • A module is similar to an algebraic ADT. It defines a state type which may be used in other modules. • A module is an object. S833 Flio- HEWLETT HPLABS - INFORMATION SYSTEMS CENTRE PACKARD SOFTWARE ENGINEERING DEPARTMENT

  7. ~ MODULE SYNTAX Module :: intf: Interface body: {Definitions} Module - - description of constructs provided by, - - or used by, the module Definitions - - collection of definitions written in the core language, but using constructs introduced by the interface end SB34 Flin- HEWLETT HPLABS - INFORMATION SYSTEMS CENTRE PACKARD SOFTWARE ENGINEERING DEPARTMENT

  8. ~ OVERVIEW OF IMPORT-EXPORT CONSTRUCTS • A module may EXPORT constructs. • Exported constructs may be imported and used by another module. • A group of modules may import constructs from each other. • A construct which is not exported is "hidden". A hidden construct may not be refered to by any other module. S935 Flin- HEWLETT HPLABS - INFORMATION SYSTEMS CENTRE PACKARD SOFTWARE ENGINEERING DEPARTMENT

  9. ~ INTERFACE - EXPORT CLAUSE Interface :: id : Id exp : ModSig m : Name -> [TypeDef] ModSig :: types m values : Name -> [Type} m fns : Name -> [FnType] m opns : Name -> [OpSig] Names of constructs with optional syntactic description S936 Flii- HEWLETT HPLABS - INFORMATION SYSTEMS CENTRE PACKARD SOFTWARE ENGINEERING DEPARTMENT

  10. ~ FULL CONCRETE SYNTAX FOR EXPORT Module INTEGER STACK exports types INTEGER_STACK operations POP 0 0> INTEGER using INTEGER_STACK PUSH (INTEGER) using INTEGER_STACK definitions end 5837 rh;' HPLABS - INFORMATION SYSTEMS CENTRE HEWLETT PACKARD SOFTWARE ENGINEERING DEPARTMENT

  11. ~ CONCRETE SYNTAX WITH IMPLICIT STATE TYPE Module INTEGER STACK exports POP 0 0> INTEGER operations PUSH (INTEGER) definitions end If an operation exported by module M does not specify the state type explicitly, then the state type is M and the type is implicitly imported. SB38 Flin- HEWLETT HPLABS - INFORMATION SYSTEMS CENTRE SOFTWARE ENGINEERING DEPARTMENT PACKARD

  12. ~ LIGHTWEIGHT SYNTAX Module INTEGER STACK exports operations POP, PUSH definitions POP 0 0> INTEGER PUSH (INTEGER) end Signatures provided by the definitions need not be repeated in the export clause. SB39 Fli;' HEWLETT HPLABS - INFORMATION SYSTEMS CENTRE SOFTWARE ENGINEERING DEPARTMENT PACKARD

  13. ~ INTERFACE - IMPORT CLAUSE Interface :: id : Id m : Id -> Mod Sig imp exp : ModSig • Id of module providing imported constructs • Syntactic description of constructs SB40 Flin- HEWLETT HPLABS - INFORMATION SYS T EMS CENTRE SOFTWARE ENGINEERING DEPARTMENT PACKARD

  14. ~ IMPLICIT STATE TYPE Module SYMBOL TABLE imports from INTEGER_STACK POP 0 0> INTEGER operations PUSH (INTEGER) end If an operation imported from a module M does not specify the state tpe explicitly, then the name of the state type is also M and the type is implicitly imported. SB41 rh;' HPLABS - INFORMATION SYSTEMS CENTRE HEWLETT PACKARD SOFTWARE ENGINEERING DEPARTMENT

  15. ~ LIGHTWEIGHT SYNTAX Module INTEGER STACK Exports POP 0 0> INTEGER Operations PUSH (INTEGER) end Module SYMBOL TABLE imports from INTEGER_STACK Operations POP, PUSH end If a document contains a module which exports a construct and another which imports it, then the signatures need to be repeated. S842 FliDW HEWLETT HPLABS - INFORMATION SYSTEMS CENTRE PACKARD SOFTWARE ENGINEERING DEPARTMENT

  16. r,~ ~ NAMES Name:: prefix : seq1 of Id local : Id module INTEGER_STACK exports operations POP, PUSH end Names reflect module structure directly - the prefix indicates where the construct is defined. The full name of POP is INTEGER STACK. POP SB43 HPLABS - INFORMATION SYSTEMS CENTRE HEWLETT PACKARD SOFTWARE ENGINEERING DEPARTMENT

  17. ~ NAMES OF IMPORTED CONSTRUCTS Module INTEGER STACK exports operations POP, PUSH end Module SYMBOL TABLE imports from INTEGER_STACK operations POP, PUSH end • The full name of a construct is not changed if it is imported. • In both modules the full names of POP and PUSH are INTEGER STACK.POP INTEGER STACK.PUSH SB44 Fli;- HEWLETT HPLABS - INFORMATION SYSTEMS CENTRE SOFTWARE ENGINEERING DEPARTMENT PACKARD

  18. ~ SEMANTICS OF THE CORE LANGUAGE • The semantics of the core language is given in terms of models" • A model is a mapping which gives a denotation to a named construct. INTEGER_STACK --> POP --> PUSH --> SB45 Fli " ;' HPLABS - INFORMATION SYSTEMS CENTRE HEWLETT SOFTWARE ENGINEERING DEPARTMENT PACKARD

  19. ~ MODELS OF A SPECIFICATION A model may - or may not - satisfy a specification definitions type RED = - - - type BLUE = - - - RED-> RED -> BLUE -> BLUE -> SB46 F/i'n- HEWLETT HPLABS - INFORMA TION SYSTEMS CENTRE SOFTWARE ENGINEERING DEPARTMENT PACKARD

  20. ~ SEMANTICS OF A SPECIFICATION • The models which satisfy a specification are picked out by a relation is-a-model-of C MODELS x Definitions • The semantics of a specification is defined to be the set of all models which satisfy the specification. { M 6 MODELS I M is-a-model-of spec} [[spec]] ~ • Defining this relation is a non-trivial task F/,-n- HEWLETT SS47 HPLABS - INFORMATION SYSTEMS CENTRE PACKARD SOFTWARE ENGINEERING DEPARTMENT

  21. ~ SQR->~ UNDEFINED CONSTRUCTS ARE UNDETERMINED RED-> SOR-> 0 RED-> UE -> RED-> SOR-> D BLUE -> BLUE -> SS48 Fli;' HEWLETT HPLABS - INFORMATION SYSTEMS CENTRE PACKARD SOFTWARE ENGINEERING DEPARTMENT

  22. ~ MODELS MAY CONTAIN JUNK ME [[spec]] A n (j dom (m) ==> m u [n->v] 6- [[spec]] • RED-> RED-> SQR-> BLUE -> BLUE -> • For any two specifications S, T, if [[S]] is non-empty it contains models which provide denotations for constructs defined or used by T. SB49 F/£;' HEWLETT HPLABS - INFORMATION SYSTEMS CENTRE PACKARD SOFTWARE ENGINEERING DEPARTMENT

  23. ~ module COLOURS exports types RED, BLUE definitions end module COLOURED_BOXES imports from COLOURS types RED, BLUE definitions RED_BOX = box of RED BLUE_BOX - box of BLUE end S950 Flin- HEWLETT HPLABS - INFORMATION SYSTEMS CENTRE SOFTWARE ENGINEERING DEPARTMENT PACKARD

  24. - ~-~ ~ RED-> ~ ~ MODELS OF COLOURED BOXES RED-> RED BOX-> BLUE-> RED-> LUE_BOX-> RED BOX-> RED -> BLUE -> RED BOX-> BLUE BOX-> UE -> BLUE BOX-> RED_BOX-> BLUE -> BLUE BOX-> SB51 rh;' HPLABS - INFORMATION SYSTEMS CENTRE HEWLETT PACKARD SOFTWARE ENGINEERING DEPARTMENT

  25. ~ MODELS OF COLOURS RED-> RED BOX-> BLUE-> RED-> LUE_BOX-> RED BOX-> RED -> BLUE -> RED BOX-> r------'----------->--- BLUE BOX-> UE -> RED-> CIRCLE -> • BLUE -> 5852 Flin- HEWLETT HPLABS - INFORMATION SYSTEMS CENTRE PACKARD SOFTWARE ENGINEERING DEPARTMENT

  26. ~ MODELS OF THE COMPLETE DOCUMENT RED -> RED_BOX -> BLUE -> BLUE BOX-> [[Document]] .6. [[COLOURS]] (\ [[COLOURED_BOXES]] 5853 Fhdi HEWLETT HPLABS - INFORMATION SYSTEMS CENTRE SOFTWARE ENGINEERING DEPARTMENT PACKARD

  27. ~ OVERVIEW OF PARAMETERISATION • A module may be paramerised by formal parameters - types, values, functions or operations. • Within the parameterised module, the formal parameters may be used like any other construct. • A parameterised module may be INSTANTIATED within another module. Formal parameters are replaced by actual parameters. • Within the instantiating module, the newly instantiated constructs may be used like any other construct. 5854 Fli-;' HEWLETT HPLABS - INFORMATION SYSTEMS CENTRE PACKARD SOFTWARE ENGINEERING DEPARTMENT

  28. rli~ ~ INTERFACE - PARAMETER CLAUSE Interface:: id : Id par: ModSig imp: Id !1!.>ModSig exp : ModSig Syntactic description of formal parameters - types, values, functions or operations. SB55 HPLABS - INFORMATION SYSTEMS CENTRE HEWLETT SOFTWARE ENGINEERING DEPARTMENT PACKARD

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend