OBSERVABILITY = TYPABILITY + INHABITATION ANTONIO BUCCIARELLI, DELIA KESNER, AND SIMONA RONCHI DELLA ROCCA IRIF, CNRS and Univ Paris-Diderot, France e-mail address : buccia@irif.fr IRIF, CNRS and Univ Paris-Diderot, France e-mail address : kesner@irif.fr Dipartimento di Informatica, Universit` a di Torino, Italy e-mail address : ronchi@di.unito.it Abstract. We define an observability property for a calculus with pattern matching which is inspired by the notion of solvability for the λ-calculus. We prove that observability can be characterized by means of typability and inhabitation in an intersection type system P based on non-idempotent types. We show first that the system P characterizes the set of terms having canonical form, i.e. that a term is typable if and only if it reduces to a canonical form. But the set of observable terms is properly contained in the set of canonical form. Thus, typability alone is not sufficient to characterize observability, in contrast to the solvability case for λ-calculus. We then prove that typability, together with inhabitation, provides a full characterization of observability, in the sense that a term is observable if and only if it is typable and the types of all its arguments are inhabited. We complete the picture by providing an algorithm for the inhabitation problem of P . 1. Introduction In these last years there has been a growing interest in pattern λ-calculi [22, 17, 11, 18, 16, 21] which are used to model the pattern-matching primitives of functional programming languages (e.g. OCAML, ML, Haskell) and proof assistants (e.g. Coq, Isabelle). These calculi are extensions of λ-calculus: abstractions are written as λp.t, where p is a pattern specifying the expected structure of the argument. In this paper we restrict our attention to pair patterns, which are expressive enough to illustrate the challenging notion of solvability/observability in the framework of pattern λ-calculi. We define a pattern calculus with explicit pattern-matching called Λ p -calculus. The use of explicit pattern-matching becomes very appropriate to implement different evaluation strategies, thus giving rise to different languages with pattern-matching [11, 12, 1]. In all of them, an application (λp.t)u reduces to t[p/u], where the constructor [p/u] is an explicit matching, defined by means of suitable reduction rules, which are used to decide if the 1998 ACM Subject Classification: F.4.1 Mathematical Logic: Lambda calculus and related systems, Proof theory. F.3.1 Specifying and Verifying and Reasoning about Programs: Logics of programs. Key words and phrases: Pattern-calculus, Type-Assignement Systems, Non-idempotent Intersection Types, Solvability, Inhabitation. LOGICAL METHODS IN COMPUTER SCIENCE DOI:10.2168/LMCS-??? c Antonio Bucciarelli, Delia Kesner, and Simona Ronchi Della Rocca Creative Commons 1 arXiv:1812.06009v1 [cs.LO] 14 Dec 2018