fbpx
Wikipedia

Algebraic semantics (computer science)

In computer science, algebraic semantics is a form of axiomatic semantics based on algebraic laws for describing and reasoning about program specifications in a formal manner.[1][2][3][4]

Syntax edit

The syntax of an algebraic specification is formulated in two steps: (1) defining a formal signature of data types and operation symbols, and (2) interpreting the signature through sets and functions.

Definition of a signature edit

The signature of an algebraic specification defines its formal syntax. The word "signature" is used like the concept of "key signature" in musical notation.

A signature consists of a set   of data types, known as sorts, together with a family   of sets, each set containing operation symbols (or simply symbols) that relate the sorts. We use   to denote the set of operation symbols relating the sorts   to the sort  .

For example, for the signature of integer stacks, we define two sorts, namely,   and  , and the following family of operation symbols:

 

where   denotes the empty string.

Set-theoretic interpretation of signature edit

An algebra   interprets the sorts and operation symbols as sets and functions. Each sort   is interpreted as a set  , which is called the carrier of   of sort  , and each symbol   in   is mapped to a function  , which is called an operation of  .

With respect to the signature of integer stacks, we interpret the sort   as the set   of integers, and interpret the sort   as the set   of integer stacks. We further interpret the family of operation symbols as the following functions:

 

Semantics edit

Semantics refers to the meaning or behavior. An algebraic specification provides both the meaning and behavior of the object in question.

Equational axioms edit

The semantics of an algebraic specifications is defined by axioms in the form of conditional equations.[1]

With respect to the signature of integer stacks, we have the following axioms:

For any   and  ,
 
where " " indicates "not found".

Mathematical semantics edit

The mathematical semantics (also known as denotational semantics)[5] of a specification refers to its mathematical meaning.

The mathematical semantics of an algebraic specification is the class of all algebras that satisfy the specification. In particular, the classic approach by Goguen et al.[1][2] takes the initial algebra (unique up to isomorphism) as the "most representative" model of the algebraic specification.

Operational semantics edit

The operational semantics[6] of a specification means how to interpret it as a sequence of computational steps.

We define a ground term as an algebraic expression without variables. The operational semantics of an algebraic specification refers to how ground terms can be transformed using the given equational axioms as left-to-right rewrite rules, until such terms reach their normal forms, where no more rewriting is possible.

Consider the axioms for integer stacks. Let " " denote "rewrites to".

 

Canonical property edit

An algebraic specification is said to be confluent (also known as Church-Rosser) if the rewriting of any ground term leads to the same normal form. It is said to be terminating if the rewriting of any ground term will lead to a normal form after a finite number of steps. The algebraic specification is said to be canonical (also known as convergent) if it is both confluent and terminating. In other words, it is canonical if the rewriting of any ground term leads to a unique normal form after a finite number of steps.

Given any canonical algebraic specification, the mathematical semantics agrees with the operational semantics.[7]

As a result, canonical algebraic specifications have been widely applied to address program correctness issues. For example, numerous researchers have applied such specifications to the testing of observational equivalence of objects in object-oriented programming. See Chen and Tse[8] as a secondary source that provides a historical review of prominent research from 1981 to 2013.

See also edit

References edit

  1. ^ a b c J.A. Goguen; J.W. Thatcher; E.G. Wagner; J.B. Wright (1977). "Initial algebra semantics and continuous algebras". Journal of the ACM. 24 (1): 68–95. doi:10.1145/321992.321997. S2CID 11060837.
  2. ^ a b J.A. Goguen; J.W. Thatcher; E.G. Wagner (1978). "An initial algebra approach to the specification, correctness and implementation of abstract data types". In R.T. Yeh (ed.). Current Trends in Programming Methodology, Vol. IV: Data Structuring. Prentice Hall. pp. 80–149.
  3. ^ J.A. Goguen; C. Kirchner; H. Kirchner; A. Megrelis; J. Meseguer (1988). "An introduction to OBJ3". Proceedings of the First Workshop on Conditional Term Rewriting Systems. Lecture Notes in Computer Science. Vol. 308. Springer. pp. 258–263. doi:10.1007/3-540-19242-5_22. ISBN 978-3-540-19242-8.
  4. ^ J.A. Goguen; G. Malcolm (1996). Algebraic Semantics of Imperative Programs. MIT Press. ISBN 9780262071727.
  5. ^ David A. Schmidt (1986). Denotational Semantics: A Methodology for Language Development. William C. Brown Publishers. ISBN 9780205104505.
  6. ^ Gordon D. Plotkin (1981). "A structural approach to operational semantics" (Technical Report DAIMI FN-19). Computer Science Department, Aarhus University.
  7. ^ S. Lucas; J. Meseguer (2014). "Strong and Weak Operational Termination of Order-Sorted Rewrite Theories". In S. Escobar (ed.). Rewriting Logic and Its Applications. Lecture Notes in Computer Science. Vol. 8663. Cham: Springer. pp. 178–194. doi:10.1007/978-3-319-12904-4_10. ISBN 978-3-319-12903-7.
  8. ^ H.Y. Chen; T.H. Tse (2013). "Equality to equals and unequals: A revisit of the equivalence and nonequivalence criteria in class-level testing of object-oriented software". IEEE Transactions on Software Engineering. 39 (11): 1549–1563. doi:10.1109/TSE.2013.33. hdl:10722/187124. S2CID 8694513.

algebraic, semantics, computer, science, computer, science, algebraic, semantics, form, axiomatic, semantics, based, algebraic, laws, describing, reasoning, about, program, specifications, formal, manner, contents, syntax, definition, signature, theoretic, int. In computer science algebraic semantics is a form of axiomatic semantics based on algebraic laws for describing and reasoning about program specifications in a formal manner 1 2 3 4 Contents 1 Syntax 1 1 Definition of a signature 1 2 Set theoretic interpretation of signature 2 Semantics 2 1 Equational axioms 2 2 Mathematical semantics 2 3 Operational semantics 2 4 Canonical property 3 See also 4 ReferencesSyntax editThe syntax of an algebraic specification is formulated in two steps 1 defining a formal signature of data types and operation symbols and 2 interpreting the signature through sets and functions Definition of a signature edit The signature of an algebraic specification defines its formal syntax The word signature is used like the concept of key signature in musical notation A signature consists of a set S displaystyle S nbsp of data types known as sorts together with a family S displaystyle Sigma nbsp of sets each set containing operation symbols or simply symbols that relate the sorts We use S s 1 s 2 s n s displaystyle Sigma s 1 s 2 s n s nbsp to denote the set of operation symbols relating the sorts s 1 s 2 s n S displaystyle s 1 s 2 s n in S nbsp to the sort s S displaystyle s in S nbsp For example for the signature of integer stacks we define two sorts namely i n t displaystyle int nbsp and s t a c k displaystyle stack nbsp and the following family of operation symbols S L s t a c k n e w S i n t s t a c k s t a c k p u s h S s t a c k s t a c k p o p S s t a c k i n t d e p t h t o p displaystyle begin aligned Sigma Lambda stack amp rm new Sigma int stack stack amp rm push Sigma stack stack amp rm pop Sigma stack int amp rm depth rm top end aligned nbsp dd where L displaystyle Lambda nbsp denotes the empty string Set theoretic interpretation of signature edit An algebra A displaystyle A nbsp interprets the sorts and operation symbols as sets and functions Each sort s displaystyle s nbsp is interpreted as a set A s displaystyle A s nbsp which is called the carrier of A displaystyle A nbsp of sort s displaystyle s nbsp and each symbol s displaystyle sigma nbsp in S s 1 s 2 s n s displaystyle Sigma s 1 s 2 s n s nbsp is mapped to a function s A A s 1 A s 2 A s n displaystyle sigma A A s 1 times A s 2 times times A s n nbsp which is called an operation of A displaystyle A nbsp With respect to the signature of integer stacks we interpret the sort i n t displaystyle int nbsp as the set Z displaystyle mathbb Z nbsp of integers and interpret the sort s t a c k displaystyle stack nbsp as the set S t a c k displaystyle Stack nbsp of integer stacks We further interpret the family of operation symbols as the following functions n e w S t a c k p u s h Z S t a c k S t a c k p o p S t a c k S t a c k d e p t h S t a c k Z t o p S t a c k Z displaystyle begin aligned rm new amp to Stack rm push amp mathbb Z times Stack to Stack rm pop amp Stack to Stack rm depth amp Stack to mathbb Z rm top amp Stack to mathbb Z end aligned nbsp dd Semantics editSemantics refers to the meaning or behavior An algebraic specification provides both the meaning and behavior of the object in question Equational axioms edit The semantics of an algebraic specifications is defined by axioms in the form of conditional equations 1 With respect to the signature of integer stacks we have the following axioms For any z Z displaystyle z in mathbb Z nbsp and s S t a c k displaystyle s in Stack nbsp A 1 p o p p u s h z s s A 2 d e p t h p u s h z s d e p t h s 1 A 3 t o p p u s h z s z A 4 p o p n e w n e w A 5 d e p t h n e w 0 A 6 t o p s 404 i f d e p t h s 0 displaystyle begin aligned amp A1 rm pop rm push z s s amp A2 rm depth rm push z s rm depth s 1 amp A3 rm top rm push z s z amp A4 rm pop rm new rm new amp A5 rm depth rm new 0 amp A6 rm top s 404 rm if depth s 0 end aligned nbsp dd dd where 404 displaystyle 404 nbsp indicates not found dd Mathematical semantics edit The mathematical semantics also known as denotational semantics 5 of a specification refers to its mathematical meaning The mathematical semantics of an algebraic specification is the class of all algebras that satisfy the specification In particular the classic approach by Goguen et al 1 2 takes the initial algebra unique up to isomorphism as the most representative model of the algebraic specification Operational semantics edit The operational semantics 6 of a specification means how to interpret it as a sequence of computational steps We define a ground term as an algebraic expression without variables The operational semantics of an algebraic specification refers to how ground terms can be transformed using the given equational axioms as left to right rewrite rules until such terms reach their normal forms where no more rewriting is possible Consider the axioms for integer stacks Let displaystyle Rrightarrow nbsp denote rewrites to t o p p o p p o p p u s h 1 p u s h 2 p u s h 3 p o p n e w t o p p o p p o p p u s h 1 p u s h 2 p u s h 3 n e w b y A x i o m A 4 t o p p o p p u s h 2 p u s h 3 n e w b y A x i o m A 1 t o p p u s h 3 n e w b y A x i o m A 1 3 b y A x i o m A 3 displaystyle begin aligned amp rm top rm pop rm pop rm push 1 rm push 2 rm push 3 rm pop rm new amp Rrightarrow amp rm top rm pop rm pop rm push 1 rm push 2 rm push 3 rm new amp rm by Axiom A4 Rrightarrow amp rm top rm pop rm push 2 rm push 3 rm new amp rm by Axiom A1 Rrightarrow amp rm top rm push 3 rm new amp rm by Axiom A1 Rrightarrow amp 3 amp rm by Axiom A3 end aligned nbsp dd Canonical property edit An algebraic specification is said to be confluent also known as Church Rosser if the rewriting of any ground term leads to the same normal form It is said to be terminating if the rewriting of any ground term will lead to a normal form after a finite number of steps The algebraic specification is said to be canonical also known as convergent if it is both confluent and terminating In other words it is canonical if the rewriting of any ground term leads to a unique normal form after a finite number of steps Given any canonical algebraic specification the mathematical semantics agrees with the operational semantics 7 As a result canonical algebraic specifications have been widely applied to address program correctness issues For example numerous researchers have applied such specifications to the testing of observational equivalence of objects in object oriented programming See Chen and Tse 8 as a secondary source that provides a historical review of prominent research from 1981 to 2013 See also editAlgebraic semantics mathematical logic OBJ programming language Joseph GoguenReferences edit a b c J A Goguen J W Thatcher E G Wagner J B Wright 1977 Initial algebra semantics and continuous algebras Journal of the ACM 24 1 68 95 doi 10 1145 321992 321997 S2CID 11060837 a b J A Goguen J W Thatcher E G Wagner 1978 An initial algebra approach to the specification correctness and implementation of abstract data types In R T Yeh ed Current Trends in Programming Methodology Vol IV Data Structuring Prentice Hall pp 80 149 J A Goguen C Kirchner H Kirchner A Megrelis J Meseguer 1988 An introduction to OBJ3 Proceedings of the First Workshop on Conditional Term Rewriting Systems Lecture Notes in Computer Science Vol 308 Springer pp 258 263 doi 10 1007 3 540 19242 5 22 ISBN 978 3 540 19242 8 J A Goguen G Malcolm 1996 Algebraic Semantics of Imperative Programs MIT Press ISBN 9780262071727 David A Schmidt 1986 Denotational Semantics A Methodology for Language Development William C Brown Publishers ISBN 9780205104505 Gordon D Plotkin 1981 A structural approach to operational semantics Technical Report DAIMI FN 19 Computer Science Department Aarhus University S Lucas J Meseguer 2014 Strong and Weak Operational Termination of Order Sorted Rewrite Theories In S Escobar ed Rewriting Logic and Its Applications Lecture Notes in Computer Science Vol 8663 Cham Springer pp 178 194 doi 10 1007 978 3 319 12904 4 10 ISBN 978 3 319 12903 7 H Y Chen T H Tse 2013 Equality to equals and unequals A revisit of the equivalence and nonequivalence criteria in class level testing of object oriented software IEEE Transactions on Software Engineering 39 11 1549 1563 doi 10 1109 TSE 2013 33 hdl 10722 187124 S2CID 8694513 Retrieved from https en wikipedia org w index php title Algebraic semantics computer science amp oldid 1177803562, wikipedia, wiki, book, books, library,

article

, read, download, free, free download, mp3, video, mp4, 3gp, jpg, jpeg, gif, png, picture, music, song, movie, book, game, games.