Manifest Contracts with Intersection Types

08/08/2019
by   Yuki Nishida, et al.
0

We present a manifest contract system PCFvΔH with intersection types. A manifest contract system is a typed functional calculus in which software contracts are integrated into a refinement type system and consistency of contracts is checked by combination of compile- and run-time type checking. Intersection types naturally arise when a contract is expressed by a conjunction of smaller contracts. Run-time contract checking for conjunctive higher-order contracts in an untyped language has been studied but our typed setting poses an additional challenge due to the fact that an expression of an intersection type τ_1 ∧τ_2 may have to perform different run-time checking whether it is used as τ_1 or τ_2. We build PCFvΔH on top of the Δ-calculus, a Church-style intersection type system by Liquori and Stolze. In the Δ-calculus, a canonical expression of an intersection type is a strong pair, whose elements are the same expressions except for type annotations. To address the challenge above, we relax strong pairs so that expressions in a pair are the same except for type annotations and casts, which are a construct for run-time checking. We give a formal definition of PCFvΔH and show its basic properties as a manifest contract system: preservation, progress, and value inversion. Furthermore, we show that run-time checking does not affect essential computation.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
09/14/2017

Combining Static and Dynamic Contract Checking for Curry

Static type systems are usually not sufficient to express all requiremen...
research
02/29/2020

Renegotiation and recursion in Bitcoin contracts

BitML is a process calculus to express smart contracts that can be run o...
research
06/26/2019

Structural Contracts – Contracts for Type Construction Dependent Types to Ensure Consistency of Extra-Functional Reasoning

Targeting to use contract-based design for the specification and refinem...
research
06/19/2018

Reasoning about Polymorphic Manifest Contracts

Manifest contract calculi, which integrate cast-based dynamic contract c...
research
06/11/2021

Union and intersection contracts are hard, actually

Union and intersection types are a staple of gradually typed language su...
research
07/01/2019

Type Checking Program Code using SHACL (Extended Version)

It is a strength of graph-based data formats, like RDF, that they are ve...
research
10/12/2022

Specializing Scope Graph Resolution Queries: Extended Edition

To warrant programmer productivity, type checker results should be corre...

Please sign up or login with your details

Forgot password? Click here to reset