Title: Defining A Formal Semantics For The Rosetta Specification Language
1Defining A Formal Semantics For The Rosetta
Specification Language
2Overview
- Introduction
- Definitions
- Basic Semantics
- Denoting Units of Semantics
- State based model
- Event based model
- Ongoing work
- Conclusion
3Next
- Introduction
- Definitions
- Basic Semantics
- Denoting Units of Semantics
- State based model
- Event based model
- Ongoing Work
- Conclusion
4Introduction
- Rosetta systems level design language
- Supports different computation models
- Addresses integration of information across
domains - Uses domains to define semantics of models
there is no unique semantics for all domains - All languages have syntax and semantics
- Rosetta has a fixed syntax, but different
semantics - Use of denotational functions for interpreting
Rosetta syntax - Decomposition of semantics into modules - each
module has a different set of denotational
functions from another
5Next
- Introduction
- Definitions
- Basic Semantics
- Denoting Units of Semantics
- State based model
- Event based model
- Ongoing Work
- Conclusion
6Definitions
- Model of computation
- Distinctive paradigm for computation,
communication, - Semantic domain
- Set of mathematical objects used to model agents
- Unifying semantic domain
- Semantic domain that can be used to represent a
variety of different computation paradigms - Unit of semantics
- A unifying semantic domain
- Denotational semantics
- Use of valuation functions to map syntactic
constructs to abstract values denoted
7Next
- Introduction
- Definitions
- Basic Semantics
- Denoting Units of Semantics
- State based model
- Event based model
- Ongoing Work
- Conclusion
8Basic Semantics Semantic modules
9Basic Semantics Denotational semantics
- Denotation in the sense of The Scott-Strachey
Approach to Programming Language - Define a semantic function that maps symbols from
a language to a known object - E.g. Let N be such a function for numerals
- N?1? 1
- N?one? 1
- where ? and ? are semantic brackets, and the
element enclosed by them is an object from the
language being defined
10Basic Semantics Evaluation functions
- Following Allisons approach (A Practical
Introduction to denotational semantics), we
identify 4 semantic functions - Expression evaluation function given a store,
maps an expression to a value - E??? Store ? Values
- Constant evaluation function maps constants and
literals to their values in the abstract value
space - V constants ? Values
- Function evaluation function maps binary
operators to the corresponding function - O??? Values ? Values ? Values
- Term evaluation function maps terms to a
boolean function - T Terms ? Store ? boolFnc
- where boolFncVars ? boolean is a function of any
number of parameters to a boolean value
11Basic Semantics Specific evaluation functions
- E??? st (st_value ?)
- E?v? st V?v?
- E?? ? ?? st O??? ?E??? st, E??? st?
- O?? ??v1, v2?. If v1 v2 then True else False
- univ ? univ ? boolean
- where
- ? is an expression ? represents identifiers
- st is the store v represents constants
- ? is a binary operator (st_value x) indicates
value of x in store st - ??param?.bodytypeFnc is a lambda expression of
type typeFnc
12Basic semantics Term evaluation examples
- Assuming store st contains
- x ? 2
- myFnc ? ?xint . x 1
- T?x2? st
- ? O?? (E?x? st) V?2?
- ? (??v1, v2?. If v1 v2 then True else False) 2
2 - ? if (2 2) then True else False
- ? True
13Basic semantics Term evaluation examples
- T?(myFnc 1) 2? st
- ? O?? ((?xint . (x 1) V?1?) V?2?)
- ? O?? ((?xint . (x 1) 1) 2
- ? True
- T?(undefFnc x) 2? st
- ? O?? ((E?undefFnc? st) 2) 2
- ? if ((E?undefFnc? st) 2) 2 then True else
False - For a facet/model to be consistent, terms always
need to be true - ? ((E?undefFnc? st) 2) 2
- a boolean equation with one unknown
(E?undefFnc? st) is the result of the evaluation
14Next
- Introduction
- Definitions
- Basic Semantics
- Denoting Units of Semantics
- State based model
- Event based model
- Ongoing Work
- Conclusion
15Denoting Units of Semantics State based
- Denotation of model is a relation over states
- Vocabulary of state based models
- States set of states, finite or infinite,
denumerable or nondenumerable - ? - the current state
- next the state transformation function
- _at_ - the apply function used for dereferencing
labels - Semantics of vocabulary
- States Var ? Values set of functions from
variables to values - ? States Var ? Values current state,
particular function - Next States ? States the transformation
function - _at_ Label ? States ? Values the apply function
- T Terms ? BoolFnc
- E ?? ? Values where ? is an expression
16Denoting Units of Semantics State based
- In Rosetta, no sequential execution
- x x 1 is expressed as x_at_next(s)x_at_s 1
- Change of state made explicit
- Elements of vocabulary apparent
- Definition of additional valuation functions
- O?_at_? ??v1, fnc? . fnc v1
- Label ? (Label ? univ) ? univ
- E?y_at_?? st E??? st y (st_value ?) y
- E?y_at_next(?)? st (st_value next) (st_value ?) y
17Next
- Introduction
- Definitions
- Basic Semantics
- Denoting Units of Semantics
- State based model
- Event based model
- Ongoing Work
- Conclusion
18Denoting Units of Semantics Event based
- Notion started with Lee and Sangiovanni-Vincentell
is Tagged Signal model - Denotation of a process is partial function or
relation on signals - Vocabulary
- Tags set of tags
- Values set of values
- Events set of events, i.e. set of T x V
- States set of states, each state uniquely
mapping to an event - Signals set of signals, each signal being a set
of events - _at_ - the apply function, dereferencing signals in
states indexed by events
19Denoting Units of Semantics Event based
- Semantics associated with vocabulary
- Events Tags x Values set of pairs of tags
and values - previousEvt Events used as index to last state
of process - evt Events refers to current state and is
event being processed - Signals ?Events set of sets of events
- sig Signals Events particular set of
events - getEvent Signals ? Events next event to be
processed - States SignalLabel ? SignalValue states are
dependent on events and are used to keep track of
signals - EventBasedState Events ? States each state
uniquely referred to by an event - _at_ SignalLabel ? Events ? ((Events ? States) ?
SignalValue) the dereferencing of a signal
label is obtained by first finding state
corresponding to event and then applying state
function to signal label to find signal value
20Denoting Units of Semantics Event based
- Modified Valuation function
- O?_at_? ??v1, evt? . (??fnc? . (fnc evt) v1)
- SignalLabels ?Events ? (Events ? States) ?
SignalValue - An example
- E?sig_at_evnt? st
- O?_at_? sig (E?evnt? st) (st_value EventBasedState)
- O?_at_? sig (st_value evnt) (st_value
EventBasedState) - (??fnc? . (fnc (st_value evnt)) sig) (st_value
EventBasedState) - ((st_value EventBasedState) (st_value evt)) sig
21Next
- Introduction
- Definitions
- Basic Semantics
- Denoting Units of Semantics
- State based model
- Event based model
- Ongoing Work
- Conclusion
22Ongoing work
- Where are we going with this ?
- Result of the denotation is a language (lambda)
which allows us to do interpretation, evaluation
and verification of a facet - However, need to ensure correct and safe
semantics - Use of co-algebra as semantic basis for a facet
model - Show that
23Next
- Introduction
- Definitions
- Basic Semantics
- Denoting Units of Semantics
- State based model
- Event based model
- Ongoing Work
- Conclusion
24Conclusion
- Rosetta provides a framework where different
semantics may be defined - Use of domain specific denotational semantics
- Also denote a facet by a monad to allow for facet
composition - Moggi uses monads to modularize semantics
- Hudak and Liang use monad transformers
- Wadler uses monads to add interaction into a
purely declarative language