Idris

Type Theory as a Workbench

A bittersweet announcement: I am pleased to announce that, together with my co-authors Edwin Brady (of St Andrews) & Guillaume Allais (soon to be of Strathclyde), we have a paper accepted to the Eelco Visser Commemorative Symposium 2023.

The work argues how we can link dependently-typed languages with language work benches, and highlights many of the techniques that Guillaume and I use when formally mechanising language’s in Idris2/Agda. The abstract is below:

Efficient and Effective Provisioning of Virtual Machines for Artefact Evaluation

I have written about artifact provisioning before. Even though I have yet to publish in recent years, I have been keeping my artifact provision game up.

This is because some conferences (ECOOP ‘23) are now requiring artefacts at time of (well a week later) of submission. This is not a bad approach per se as it contributes towards reproducible results, in some form. Moreover, when reviewing artefacts in the past, I have had to download GBs worth of VM for what is essentially a very small program, or download GBs of data on top of that (this was related to external propriety software).

Follow the Trail! Visualising Bi-Directional Type-Checking as Network Communication.

Note If the images do not appear change the file-extention to dot, and you can download the raw file and use xdot to recreate the images.

Language Instances as Graphs

On Tuesday, 7th June 2022 I was fortunate enough to attend the Huawei Coffee House talk on port graphs by Maribel Fernández. An interesting comment made by Maribel, and some audience members, was that we should not think about derivations (i.e. used in the type checking process or to describe evaluation) as tree but rather we view them as graphs. Such a mindset easily supports visualisation of properties such as confluence: evaluation of a term will, regardless of strategy, will result in the same value.

Being Positively Negative.

We will need some helpers…

import Decidable.Equality
import Data.List
import Data.Nat
import Data.Zippable

Being Truthful

namespace Intro

Predicates and their decision procedures are a core technique in dependently-typed programming to represent truth (predicate) and a way to discern if something holds (the decision procedure). Take for example, existential quantification that an element is in a list. Standard functional programming techniques would represent this as a boolean test.

  isElem : Eq type
        => (x  :      type)
        -> (xs : List type)
              -> Bool
  isElem x []
    = False
  isElem x (y :: ys)
    = x == y || isElem x ys

Predicates hold the Truth

namespace Predicates

We can make this programme stronger using dependent types. First we define a predicate to describe what it means for an element to exist within a list.

Wiring Circuits is as easy as 0-1-Omega, or is it...

In February 2022 I gave a PLInG talk about some work I have done investigating the application of quantitative type-systems to reasoning about wiring in netlists. I am rehashing this talk for an internal seminar.

Quantitative types allow us to reason more precisely about term usage in our programming languages. There are, however, other styles of language in which quantitative typing is beneficial: Hardware Description Languages (HDLs) for one. When wiring the components together it is important to ensure that there are no unused ports or dangling wires. Here the notion of usage is different to that found in general purpose languages. Although many linearity checks are detectable using static analysis tools such as Verilator, it is really interesting to investigate how we can use /fancy types/ (specifically quantitative-type-theory & dependent types) to make wire usage an intrinsic check within the type-system itself. With these /fancy types/ we can provide compile-time checks that all wires and ports have been used.

Types as Interpreters for HDLs to Graphs.

As part of my PhD I was interested in: Types as (Abstract) Interpreters. This approach embeds an interpretation of your model directly in the type of your terms. A previous post details it.

As port of my current work I have been investigating the construction of Hardware Description Languages (HDLs) and reasoning about their structure using denotational semantics. Currently my soundness checks are extrinsic to the intrinsically typed term language I have developed. It only recently occured to me that we can make these soundness checks intrinsic using the Types as (Abstract) Interpreters approach.

Thoughts on API Design for Dependently-Typed Languages

API design is an important aspect of Library Design. Having programmed, for what seems like an age, on personal-ish projects I often do not give this much thought: I don’t have users. Recently, however, I had a lightbulb type moment when constructing a module for checking that graphs have a certain structural properties. Now I do not think this moment is special, unique, or something new. It is an observation:

Formalising the (Sub-)Structural Aspects of SystemVerilog

Today, I am very pleased to be traveling all the way to the Programming Languages and Systems Group at the University of Kent in Canterbury.

This is not the first time that I have given a talk at Kent. Years a go I spoke at a CryptoForma workshop hosted there. The topic was on linking dependent types, session types, and protocol implementation validation. A topic that I should revisit once my restraints are released, and I am unshackled!

Faking Linear Variable Usage

I have been thinking, again, about way’s in which one can encode linear variable usage in EDSLs.

One cannot state usage on things that one cannot bind.

We can encode EDSLs using intrinsically well-typed EDLS that, at the type-level, gives all terms a type type and carries around the local typing context. Bound variables are represented using De Bruijn indices encoded as existential quantification over a type-level context.

Synthesised or Checked?

A classic example in the world of dependently typed programming is that of presenting the STLC (and extensions) as well-typed EDSLs.

The STLC as an Idris EDSL.

Below we give a simple example of the STLC with Booleans.

data Ty = TyBool | TyFunc Ty Ty

data STLC : (ctxt : List Ty)
         -> (type : Ty)
                 -> Type
  where
    Var : Elem type ctxt -> STLC ctxt type

    Func : (body : STLC (type_param :: ctxt)                    type_body)
                -> STLC                ctxt  (TyFunc type_param type_body)

    App : (func  : STLC ctxt (TyFunc type_param type_body))
       -> (param : STLC ctxt         type_param)
                -> STLC ctxt                    type_body

    B : (b : Bool) -> STLC ctxt TyBool

STLC is intrinsically well-typed in that, at the type-level, all terms are given a type type and has the local typing context. Within STLC, bound variables are represented using De Bruijn indices encoded as existential quantification over a type-level context.

1 2 3 4 5 Next →