## Section: New Results

### Bull, an Interactive Type Checker with Union and Intersection Types

Participants : Luigi Liquori, Claude Stolze.

Starting from our theoretical researches on Intersection and Union Types and related Subtype Theories, we have designed and implemented a prototype of an Interactive Typechecker based on the 2018 work on the $\Delta $-framework [43], on the 2017 work on decidable subtyping logic for Intersection and Union types [45], and on our recent advances on the $\Delta $-calculus [42] and [14]. The prototype is called *Bull*; Bull has a command-line interface where the user can declare axioms, terms, and perform computations. These terms can be incomplete, therefore the type checking algorithm uses unification to try to construct the missing subterms.
A Read-Eval-Print-Loop allows to define axioms and definitions, and performs some basic terminal-style features like error pretty-printing, subexpressions highlighting, and file loading. Moreover, it can typecheck a proof and normalize it. We use the syntax of *Pure Type Systems* of Berardi
to improve the compactness and the modularity of the kernel. Abstract and concrete syntax are mostly aligned: the concrete syntax is similar to the concrete syntax of the ITP Coq.
We have also designed and implemented a *higher-order unification algorithm* *à la* Huet for terms, while typechecking and partial type inference are done by our *bidirectional refinement algorithm*.
The refinement can be split into two parts: the essence refinement and the typing refinement. The bidirectional refinement algorithm aims to have partial type inference, and to give as much information as possible to the unifier. For instance, if we want to find a $?y$ such that ${\u22a2}_{\Sigma}\langle \lambda x:\sigma .x,\lambda x:\tau .?y\rangle :(\sigma \to \sigma )\cap (\tau \to \tau )$, we can infer that $x:\tau \u22a2?y:\tau $ and that $\wr \phantom{\rule{0.166667em}{0ex}}?y\phantom{\rule{0.166667em}{0ex}}\wr {=}_{\beta}x$.
We are experimenting with classical examples in Bull, like the ones formalized by Pfenning with his Refinement Types in LF, and we are looking for examples taking into account preorders, constraints and operators (like *e.g.* $<,\le ,>,\ge ,\cup ,\cap $...) that could be interpreted as timed algebras expressions *à la* CCSL. This would be a little step toward the formal and certified definition of a simple timed type systems for the $\lambda $-calculus and a Timed Logical Framework.

The software can be actually retrieved on the GitHub repository Bull (registration to the BIL Inria data base is in progress).