Algebraic laws for object oriented programming with references

Detalhes bibliográficos
Ano de defesa: 2015
Autor(a) principal: PALMA, Giovanny Fernando Lucero
Orientador(a): SAMPAIO, Augusto Cezar Alves
Banca de defesa: Não Informado pela instituição
Tipo de documento: Tese
Tipo de acesso: Acesso aberto
Idioma: eng
Instituição de defesa: Universidade Federal de Pernambuco
Programa de Pós-Graduação: Programa de Pos Graduacao em Ciencia da Computacao
Departamento: Não Informado pela instituição
País: Brasil
Palavras-chave em Português:
Link de acesso: https://repositorio.ufpe.br/handle/123456789/14930
Resumo: There are several approaches to defining a formal semantics of a programming language. The main established ones are operational, denotational and axiomatic semantics. The first two rely on defining an explicit model, whereas the latter one is based on postulating relevant properties of the language in terms of axioms. Particularly, in a purely algebraic approach the axioms take the form of conditional equations (typically denoted as programming laws) that relate the language constructs. Without requiring an explicit model, the advantage of the algebraic approach is incrementality: the language can be extended and the laws tend to remain valid, provided the new constructs do not interfere with the behaviour of the original ones. Algebraic laws have been proposed to uncover interesting properties of several programming paradigms: imperative, logic, functional, concurrent and object oriented, among others. As for the other paradigms, there is a comprehensive set of laws for object oriented constructs, but these are restricted to a language with copy semantics; some laws to deal with references have also been proposed, but these are tailored to specific applications, and are far from being comprehensive. In general, formal reasoning with references has been a persistent challenge and algebraic approaches usually have avoided including them in programming languages. We propose a set of algebraic laws for reasoning about object oriented programs with a reference semantics. First we focus on sequential imperative programs that use object references like in Java. The theory is based on previous work by adding laws to cope with object references. The incrementality of the algebraic method is fundamental; with a few exceptions, existing laws for copy semantics are entirely reused, as they are not affected by the reference semantics. As an evidence of relative completeness, we show that any program can be transformed, through the use of our laws, to a normal form which simulates it using an explicit heap with copy semantics. Soundness is addressed by illustrating how some of the laws can be proved in a relational semantics for a subset of the language. We extend the theory of imperative programs for an object oriented language with the usual constructs: additional imperative commands with references, classes with inheritance and subtyping, visibility control, dynamic binding, type tests and downcasts. Algebraic laws are proposed for these new constructs. In order to illustrate the expressiveness of the laws for the object oriented language, we characterize and prove a set of refactorings from Fowler’s catalog. These are contrasted with previous work that formalized refactorings in the context of copy semantics.