SlideServe
Menu
Préférences
© SlideServe · v2026

Schema Operators in State Description and Operations

thai avatar
42 diapositives · 556 Views · Jul 15, 2014

Understand how schema operators describe and combine system states, operations, and aspects for efficient and structured modeling. Learn to factorize descriptions, use conjunctions, decorations, and disjunctions to represent system states and operations effectively.

Schema Operators in State Description and Operations - slide 1
01 / 42Schema Operators in State Description and Operations
1 / 17

Télécharger la présentation

Schema Operators in State Description and Operations
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Schema Operators

  2. State • We can use the language of schemas to describe the state of a system, and operations upon it. • Different aspects of the state -- and different aspects of a given operation -- can be described as separate schemas; these schemas may be combined in various ways using schema operators. • In this way, we may factorise the description, identifying common aspects for re-use, and providing structure.

  3. Schema operators

  4. Same variable declared in both schemas must match the its type • Otherwise the conjunction will be undefined

  5. Schema conjunction allows specifying different aspects of a specification separately • Combine them to form a complete description • Adv: simple, well-structured, can be easily understood

  6. Example • From previous lecture : the schema for BoxOffice • let say the theatre has premiere and standard performances. Let declared new variable of type Status to differentiate the kind of performances

  7. Example • let say we have a set friends who are currently registered as friends of the theatre. Only those customers who are friends may buy seats for the premieres • If the current performance is a premiere, then seats may be sold only to friends

  8. Example • We use conjunction to describe an enhance box office • It is equivalent to

  9. Schema Inclusion • Reuse the name of one schema in the declaration part of another • When a schema name appears in a declaration part of a schema, the result is a merging of declarations and a conjunction of constraints.

  10. Schema decoration

  11. Schema decoration • Suppose the state of a system is modelled by a schema State with two components a and b, and these are introduced under a constraint P State a : A b : B P • Each object of schema type State represents a valid state : a binding of a and b in which predicate P is satisfied • P forms part of state invariant for the system

  12. Schema decoration • to describe an operation upon the state; use two copies of State: one represents the state before the operation; the other represents the state afterwards. We use decoration to distinguish them State’ a’ : A b’ : B P[a’/a,b’/b]

  13. Schema decoration • We may describe an operation by including both State and State’ in the declaration part

  14. Example • The set of all valid states of box office system • Each state is a binding of variable seating and sold; the state invariant insists that only allocated seats are sold, and the relationship between seats and customers remains functional

  15. Example • To describe the state of box office system after some operation • Introduces seating’ and sold’ to correspond to the seat seating and the sales record after the operation has been performed.

  16. Example • Encapsulate all of the information in a single schema; schema representing the successful purchasing of seat s? by customer c?

  17. Exercise • You were given a schema named Library during the last week lecture. The schema shows state before operation. You are required to write another schema to show the state after operation. Then write another schema named LibraryState to show the merging of the schemas before and after operation

  18. Input and Output • An operation may involve inputs and outputs. These are declared in the normal way, although there is a convention regarding their names: - the name of an input should end in a question mark - the name of an output should end in an exclamation mark

  19. Input and Output: example

  20. Input and Output: example

  21. s? is an input seat (name of seat); c? is the input customer (name of customer) buying s? • the predicate s?  seating \ dom sold is to make sure that input seat is available for sale beforehand • The predicate sold’ = sold  {s? ↦ c?}

  22. We may add an output to our description of operation • We use response from a free type of responses Response = ok | sorry • And may be declared in a separate schema Success • The effect of a successful purchase is Purchase0 Success r! : Response r! = ok

  23. exercise • Use schema inclusion for schema Add_book_to_library_ok

  24. Delta and Xi

  25. exercise • What should be in Add_book_to_library_ok now? • write a schema to check if a book is already in the library by using Library

  26. Initialisation • When using an abstract data type for a system, we should include a description of the initial state. • An initialisation is a special operation for which the before state is unimportant. (does not refer to before state) • Such an operation can be modelled by an operation schema that contains only a decorated copy of the state:

  27. example Init_library Library’ books’ =  borrowers = 

  28. Schema Disjunction • If S and T are two schemas, then their disjunction S T is a schema - whose declaration is a merge of the two declarations - whose constraint is a disjunction of the two constraints

  29. example • Schema to describe unavailable seat • Schema to indicate a seat could not be sold Failure r! : Response r! = sorry

  30. Can combine to the schemas to describe complete operation for purchase: Purchase ≙ (Purchase0 Success)  (NotAvailable  Failure)

  31. example • For a complete schema to add a book to library is as below: Add_book_to_library ≙ Add_book_to_library_ok  Book_already_in_library

  32. Exercise • Write a complete schema to add a borrower to the library system. Please refer to the handout given to the class.