Fully funded PhD scholarship: Trustworthy Refactoring Tools for Haskell Programs

Supervisor: Dr Christopher Brown

Proposal and Context

Software is large and complex. Ubiquitous systems, such as weather forecasting, medical imaging, advanced AI and big-data processing are extremely expensive and time-consuming for software companies to produce. Moreover, they often comprise many subtle bugs that can have disastrous consequences, are difficult to find, and difficult or impossible to fix. What developers need are specialised software refactoring tools that help them develop these important and complex systems in a safe and semi-automated way, reducing developer time, human error and overall increasing productivity, saving companies and customers money, and providing robust, safe, systems that have been developed in a responsible and trustworthy way.

Refactoring is the process of changing the structure of software without changing what it does: in effect, refactoring is about helping the programmer re-purpose their code to make it more understandable, accessible, or amenable to further change in the program’s design. It is often a process that developers use on a daily basis by manually changing code to reflect an API change, re-purposing methods, eliminating duplicated code, remaining variable parameters and function names, generalising functions, etc.  However, this process is rather tedious and cumbersome to apply manually: effecting a structural change that could potentially affect millions of lines of code across thousands of files is inevitably error – prone.

The advent of refactoring tool-support provides developers with automated transformations that they can apply to their code base, usually through an existing IDE interface. Refactoring tools, on the other hand, provide a way to apply refactorings across an entire code base in a semi-automatic way: they rely on the user to make certain choices about which refactorings to perform but are automatic in their underlying machinery. This automated underlying machinery means that both simple and complex refactorings can be applied to large code bases comprising thousands of files and millions of lines of code instantly.

However, automated tools are prone to bugs. This has the potentially disastrous consequence of a refactoring tool refactoring a program into one that contains subtle bugs or changes in behaviour. Despite the obvious implication that this will refactor software to contain, perhaps, subtle and difficult-to-spot bugs, it also erodes developers’ confidence in using refactoring —and general software tools— in general. Furthermore, a refactoring that introduces errors or is not trustworthy requires the programmer to inspect the transformed code, therefore taking out the benefit of using an automated tool in the first place. The problem is also amplified in that refactoring tools are extremely cumbersome, laborious and difficult in themselves to implement, especially over large programming languages, such as Haskell. This makes the refactorings deployed in such tools limited, both in number and applicability.

What is needed is to answer the following research questions:

  1. How can we provide an automated approach of implementing refactoring tools, via compositionality and proof search?
  2. How can we have the means to generate new refactorings easily that are safe and trusted by the developers that require them?
  3. How can we provide a means to generate soundness proofs that the refactorings are safe and verified, in an automated way?

Exploratory Ideas

The PhD will be exploratory in nature. Here are some ideas for research directions to investigate as part of the PhD:

  1. Formally characterise a number of refactorings for Haskell and prove properties of their general soundness.
  2. Develop a fully verified refactoring tool that encodes general soundness proofs as part of its implementation using e.g., Dependent Types for the full Haskell standard.
  3. Model a fully verified static and functional semantics for Haskell using e.g., Dependent Types.
  4. Provide a fully generalised theory of the formalisation of refactoring tools for e.g., Haskell.
  5. Provide an automated technique to find refactorings and proofs of refactorings, via e.g., proof search and compositionality of sub-proofs.
  6. Evaluate the applicability of the approach on a number of use-cases and domains, from a variety of languages, across a different number of verticals.

Supervisor and Background

The PhD project is to be supervised by Dr Christopher Brown, a lecturer in the school of computer science who has over 18 years of experience working in the field of refactoring, program transformation and functional programming. Dr Brown contributed to the original HaRe (Haskell Refactorer) system, developed at the university of Kent, and has since developed a number of new refactoring tools for a variety of languages, including Haskell, Erlang and C/C++ for introducing and tuning parallel programs. Dr Brown also works in the field of formal semantics, with prior work on formalising refactorings and using types to reason about e.g., extra functional properties of imperative systems for embedded languages.

The PhD project fits directly with the research vision of the supervisor, who is also working on building refactoring tools for dependently typed languages, such as Idris and Pi-Forall.

The Programming Languages Research Group

The Programming Languages Research Group has a long history in functional programming and type theory. This project would directly fit with the group’s general vision of:

  1. Making programming languages more accessible to experienced and inexperienced programmers alike.
  2. Providing tool-support to make programming more accessible to inexperienced programmers.
  3. Using types to formalise general soundness of programming language properties and semantics.
  4. Providing verified refactoring tooling for functional programs.

To apply

Informal inquiries can be directed to Chris Brown. Formal applications can be made through the School’s postgraduate research portal.

The deadline for applications is 1 March 2023.

Congratulations Rosa!

Congratulations to Rosa Filgueira who has been awarded with the UK Young Academy (UKYA) membership

The UK Young Academy’s first cohort brings together members from across academia, charity organisations and the private sector, to galvanise their skills, knowledge, and experience to find innovative solutions to the challenges facing societies now and in the future.

PhD opportunity: Interdisciplinary approaches for improving biodiversity assessments using remote sensors

Funded PhD opportunity.

The project will be heavy on state of the art machine learning with applications to statistical ecology. The project will be jointly supervised by the Schools of Maths and Stats (Alison Johnston, Chris Sutherland) and Computer Science (Kasim and Oggie) and potentially fully funded by CREEM.

Strong applicants with experience with deep learning and strong maths background are particularly welcome to apply.

Workshop on Teaching and Assessing Technology Ethics, Tuesday 6 Dec

If you are currently teaching or interested in teaching anything to do with ethics and technology, then please consider attending a half-day workshop that Dharini Balasubramaniam and Tristan Henderson are holding in JC 1.33 on Tuesday 6 Dec.

The aim is to discuss challenges, share syllabi and best practices, and ideally to build a shared repository of teaching resources.

This event is kindly sponsored by the SICSA Education theme.

Teaching and Assessing Technology Ethics

November Graduation

The School of Computer Science will host a small graduation reception in the JC coffee area on Tuesday 29th November between 14:00-16:00.

Graduating students and their guests are invited to come along and celebrate with a glass of bubbly.

Computer Science degrees will be conferred in an afternoon ceremony in the Younger Hall. Family and friends who can’t make it on the day can watch a live broadcast of graduation.

Research hub considers response to life beyond Earth

The new SETI Post-Detection Hub, coordinated by Dr John Elliott, an honorary research fellow of the School of Computer Science has gathered widespread press interest, across UK, Europe, USA, Canada, South America and South East Asia.

The Hub hosted by the Centre of Exoplanet Science and the Centre for Global Law and Governance of the University of St Andrews, will act as a coordinating centre for an international effort bringing together diverse expertise across both the sciences and the humanities for setting out impact assessments, protocols, procedures, and treaties designed to enable a responsible response should we discover intelligent life forms beyond our planet.

More information about the hub can be found in the university press release