A Quantitative Understanding of Pattern Matching

12/04/2019
by   Sandra Alves, et al.
0

This paper shows that the recent approach to quantitative typing systems for programming languages can be extended to pattern matching features. Indeed, we define two resource aware type systems, named U and E, for a lambda-calculus equipped with pairs for both patterns and terms. Our typing systems borrow some basic ideas from [BKRDR15], which characterises (head) normalisation in a qualitative way, in the sense that typability and normalisation coincide. But in contrast to [BKRDR15], our (static) systems also provides quantitative information about the dynamics of the calculus. Indeed, system U provides upper bounds for the length of normalisation sequences plus the size of their corresponding normal forms, while system E, which can be seen as a refinement of system U, produces exact bounds for each of them. This is achieved by means of a non-idempotent intersection type system equipped with different technical tools. First of all, we use product types to type pairs, instead of the disjoint unions in [BKRDR15], thus avoiding an overlap between "being a pair" and "being duplicable", resulting in an essential tool to reason about quantitativity. Secondly, typing sequents in system E are decorated with tuples of integers, which provide quantitative information about normalisation sequences, notably time (c.f. length) and space (c.f. size). Another key tool of system E is that the type system distinguishes between consuming (contributing to time) and persistent (contributing to space) constructors. Moreover, the time resource information is remarkably refined, because it discriminates between different kinds of reduction steps performed during evaluation, so that beta reduction, substitution and matching steps are counted separately.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
02/15/2018

Non-idempotent types for classical calculi in natural deduction style

In the first part of this paper, we define two resource aware typing sys...
research
02/10/2020

The Bang Calculus Revisited

Call-by-Push-Value (CBPV) is a programming paradigm subsuming both Call-...
research
05/02/2021

The Power of Tightness for Call-By-Push-Value

We propose tight type systems for Call-by-Name (CBN) and Call-by-Value (...
research
11/30/2022

Linear Rank Intersection Types

Non-idempotent intersection types provide quantitative information about...
research
07/06/2018

Tight Typings and Split Bounds

Multi types---aka non-idempotent intersection types---have been used to ...
research
03/15/2023

Quantitative Global Memory

We show that recent approaches of static analysis based on quantitative ...

Please sign up or login with your details

Forgot password? Click here to reset