CafeOBJ Hidden Sorts - PowerPoint PPT Presentation

1 / 20
About This Presentation
Title:

CafeOBJ Hidden Sorts

Description:

Hidden algebra. Hidden sorts represent objects. Behavioural operators ... Behavioural equations should be reserved for cases where explicit statements are ... – PowerPoint PPT presentation

Number of Views:69
Avg rating:3.0/5.0
Slides: 21
Provided by: csM8
Category:

less

Transcript and Presenter's Notes

Title: CafeOBJ Hidden Sorts


1
CafeOBJ Hidden Sorts
  • Formal Methods se304/cs407
  • Thanks to Joseph Goguen, Ataru T. Nakagawa,
    Toshimi Sawada, Kokichi Futatsugi

2
  • I saw a man on a hill with a telescope

3
Hidden sorts
  • Weve been covering visible sorts
  • Another type
  • Hidden sorts
  • Exist for specifying object oriented (OO) systems
  • Hard maths

4
Hidden Sorts
  • They effectively handle
  • Concurrency,
  • Distribution,
  • Non-determinism,
  • Classes, sub-classes (inheritance),
  • Attributes and methods,
  • Parameterised programming
  • ...

5
Hidden Algebra
  • Based on
  • Observational abstraction, aka
  • Behavioural satisfaction
  • New type of equivalence
  • Behavioural equivalence
  • Two terms are equal iff they behave identically
    under the given set of observations

6
Syntax for sort signature
  • Visible sorts
  • list
  • Hidden sorts
  • list
  • This makes it impossible to have
  • Visible sub-sorts of hidden sorts, or
  • Hidden sub-sorts of visible sorts
  • They are disjoint sets

7
Operators
  • Behavioural operators
  • bop name list_of_sorts -gt sort
  • Arity contains exactly one hidden sort

8
Hidden algebra
  • Hidden sorts represent objects
  • Behavioural operators represent methods
  • This is why bops must have exactly one hidden
    operand
  • That is the object on which the method is being
    called

9
Example
  • Account
  • bop deposit Account Nat -gt Account
  • bop withdraw Account Nat -gt Account
  • bop balance Account -gt Nat
  • op deposit Account Nat -gt Account

10
Remember
  • Behavioural equivalence
  • Two terms are equal iff they behave identically
    under the given set of observations
  • bops are those observations

11
Behavioural equations
  • beq term term .
  • bceq term term if boolean_term .
  • If either term has an operator with a hidden sort
    in its arity
  • That operator must be behavioural

12
example
  • S a hidden sort and T a visible sort
  • Which of the following operators would be allowed
    in a behavioural equation using S and T?

13
example
  • bop f S -gt T
  • bop g S T -gt S
  • op c -gt T
  • op d -gt S
  • op h T -gt T
  • op k T -gt S
  • op u S -gt T
  • op v S T -gt T

Behavioural
Dont have S in arity
Have S in arity
14
Ordinary equations
  • Most behavioural equality is defined with
    ordinary equations
  • Behavioural equations should be reserved for
    cases where explicit statements are required
  • Typically when stating theorems

15
Equivalence relations
  • Reflexivity
  • X X
  • Symmetry
  • X Y gt Y X
  • Transitivity
  • X Y, Y Z gt X Z

16
Partial equivalence
  • Take out one of those three attributes
  • Partial equivalence
  • Take out symmetry
  • Transitions
  • trans term gt term .
  • ctrans term gt term if boolean term .
  • btrans term gt term .
  • bctrans term gt term if boolean term .

17
Transition vs. equation
  • module CHOICE
  • State
  • ops a b -gt State
  • op __ State State -gt State
  • vars X Y State
  • trans X Y gt X .
  • trans X Y gt Y .

18
Transition vs. equation
  • module CHOICE
  • State
  • ops a b -gt State
  • op __ State State -gt State
  • vars X Y State
  • eq X Y X .
  • eq X Y Y .

19
Todays lab
  • Write modules specifying the
  • Admin and
  • Student
  • Classes from lab 1
  • Revision of previous labs

20
Marking scheme
  • Next weeks lab is for revision
  • Read over previous labs and ask questions
  • Optional lab-exam in last week of semester
  • If you dont take it, your CA mark will not
    change
  • If you do take it, it will be worth 40 of your
    CA mark
  • It will be based on the labs you have done
  • Because of the exam, todays lab wont be worth
    as much as I said previously.
Write a Comment
User Comments (0)
About PowerShow.com