Negations in Refinement Type Systems

Similar documents
Categorical models of type theory

T. Background material: Topology

CSE 20 DISCRETE MATH. Fall

Game Semantics for Dependent Types

CSE 20 DISCRETE MATH. Winter

LOGIC AND DISCRETE MATHEMATICS

Verifying Liveness Properties of ML Programs

4. Simplicial Complexes and Simplicial Homology

CS422 - Programming Language Design

Lecture Note: Types. 1 Introduction 2. 2 Simple Types 3. 3 Type Soundness 6. 4 Recursive Types Subtyping 17

Cell-Like Maps (Lecture 5)

Lecture - 8A: Subbasis of Topology

Refinement Types as Proof Irrelevance. William Lovas with Frank Pfenning

Lecture 15: The subspace topology, Closed sets

Lecture 0: Reivew of some basic material

Lecture-12: Closed Sets

Final Test in MAT 410: Introduction to Topology Answers to the Test Questions

EDAA40 At home exercises 1

CS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Dan Grossman Spring 2011

THREE LECTURES ON BASIC TOPOLOGY. 1. Basic notions.

Chapter 21: Metatheory of Recursive Types. Induction and Coinduction Finite and Infinite Types/Subtyping Membership Checking

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016

Recursively defined cpo algebras

Distributed Systems Programming (F21DS1) Formal Verification

Automatic synthesis of switching controllers for linear hybrid systems: Reachability control

TOPOLOGY, DR. BLOCK, FALL 2015, NOTES, PART 3.

9.5 Equivalence Relations

Universes. Universes for Data. Peter Morris. University of Nottingham. November 12, 2009

COMP 4161 NICTA Advanced Course. Advanced Topics in Software Verification. Toby Murray, June Andronick, Gerwin Klein

On the duality of topological Boolean algebras

Towards a Software Model Checker for ML. Naoki Kobayashi Tohoku University

Dynamic Logic David Harel, The Weizmann Institute Dexter Kozen, Cornell University Jerzy Tiuryn, University of Warsaw The MIT Press, Cambridge, Massac

Foundations of AI. 9. Predicate Logic. Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution

CSE 105 THEORY OF COMPUTATION

M3P1/M4P1 (2005) Dr M Ruzhansky Metric and Topological Spaces Summary of the course: definitions, examples, statements.

THE DOLD-KAN CORRESPONDENCE

Discrete Mathematics Lecture 4. Harper Langston New York University

A Little Point Set Topology

A First-Order Logic with First-Class Types

λ calculus is inconsistent

Reflection in the Chomsky Hierarchy

Towards a Logical Reconstruction of Relational Database Theory

Programming with Universes, Generically

Overview. CS389L: Automated Logical Reasoning. Lecture 6: First Order Logic Syntax and Semantics. Constants in First-Order Logic.

Contents. Chapter 1 SPECIFYING SYNTAX 1

MA651 Topology. Lecture 4. Topological spaces 2

Handout 9: Imperative Programs and State

Lecture 17: Continuous Functions

Foundations of Computer Science Spring Mathematical Preliminaries

Bijective counting of tree-rooted maps and connection with shuffles of parenthesis systems

Automated Refinement Checking of Asynchronous Processes. Rajeev Alur. University of Pennsylvania

Runtime Behavior of Conversion Interpretation of Subtyping

CSC Discrete Math I, Spring Sets

Coalgebraic Semantics in Logic Programming

Formal languages and computation models

Programming and Proving with Higher Inductive Types

CMPS 277 Principles of Database Systems. Lecture #11

Binary Decision Diagrams

Combinatorics I (Lecture 36)

Lecture 19 Thursday, March 29. Examples of isomorphic, and non-isomorphic graphs will be given in class.

3.7 Denotational Semantics

A Typed Lambda Calculus for Input Sanitation

Semantical Characterization of unbounded-nondeterministic ASMs

CMSC 336: Type Systems for Programming Languages Lecture 5: Simply Typed Lambda Calculus Acar & Ahmed January 24, 2008

On the Recognizability of Arrow and Graph Languages

Slides for Faculty Oxford University Press All rights reserved.

Graph Theory S 1 I 2 I 1 S 2 I 1 I 2

1 Introduction. 3 Syntax

arxiv:math.co/ v1 27 Jan 2006

THEORY OF COMPUTATION

axiomatic semantics involving logical rules for deriving relations between preconditions and postconditions.

Model Checking with Automata An Overview

EXTENSIONS OF FIRST ORDER LOGIC

Lecture notes for Topology MMA100

Introductory logic and sets for Computer scientists

On the reflection and the coreflection of categories over a base in discrete fibrations

Lecture slides & distribution files:

Simplicial Objects and Homotopy Groups. J. Wu

Finite Model Generation for Isabelle/HOL Using a SAT Solver

Bijective counting of tree-rooted maps and shuffles of parenthesis systems

Constrained Types and their Expressiveness

CSE 105 THEORY OF COMPUTATION

Types and Programming Languages. Lecture 8. Recursive type

Trees. 3. (Minimally Connected) G is connected and deleting any of its edges gives rise to a disconnected graph.

Denotational Semantics. Domain Theory

An introduction to Category Theory for Software Engineers*

Cubical sets as a classifying topos

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages

In class 75min: 2:55-4:10 Thu 9/30.

Complexity Theory. Compiled By : Hari Prasad Pokhrel Page 1 of 20. ioenotes.edu.np

Counting multiplicity over infinite alphabets

Bounded subsets of topological vector spaces

Introductory Combinatorics

Overview of SRI s. Lee Pike. June 3, 2005 Overview of SRI s. Symbolic Analysis Laboratory (SAL) Lee Pike

(Refer Slide Time: 0:19)

STABILITY AND PARADOX IN ALGORITHMIC LOGIC

System Correctness. EEC 421/521: Software Engineering. System Correctness. The Problem at Hand. A system is correct when it meets its requirements

2 A topological interlude

Math 734 Aug 22, Differential Geometry Fall 2002, USC

ACLT: Algebra, Categories, Logic in Topology - Grothendieck's generalized topological spaces (toposes)

Transcription:

Negations in Refinement Type Systems T. Tsukada (U. Tokyo) 14th March 2016 Shonan, JAPAN

This Talk About refinement intersection type systems that refute judgements of other type systems.

Background Refinement intersection type systems are the basis for model checkers for higher-order model checking (cf. [Kobayashi 09] [Broadbent&Kobayashi 11] [Ramsay+ 14]), software model-checker for higher-order programs (cf. MoCHi [Kobayashi+ 11]). In those type systems, a derivation gives a witness of derivability, but nothing witnesses that a given derivation is not derivable.

Motivation A witness of underivability would be useful for a compact representation of an error trace an efficient model-checker in collaboration with the affirmative system cf. [Ramsay+ 14] [Godefroid+ 10] development of a type system proving safety In some cases (e.g. [T&Kobayashi 14]), a type system proving failure is easier to be developed.

Contribution Development of type systems refuting derivability in some type systems such as a basic type system for the λ-calculus a type system for call-by-value reachability Theoretical study of the development

Outline Negations in type systems for the call-by-name λ -calculus Target language Affirmative System Negative System the call-by-name λ -calculus + recursion Semantic analysis Discussions

CbN λ -calculus A simply typed calculus equipped with βη-equivalence. Kinds (i.e. simple types): Terms:

CbN λ -calculus A simply typed calculus equipped with βη-equivalence. Typing rules:

CbN λ -calculus A simply typed calculus equipped with βη-equivalence. Equational theory:

Outline Negations in type systems for the call-by-name λ -calculus Target language Affirmative System Negative System the call-by-name λ -calculus + recursion Semantic analysis Discussions

Affirmative system for CbN λ The type system for higher-order model checking (without the rule for recursion). Types are parameterised by kinds and ground type sets: We use the following syntax for types:

Sets of Types via Refinement Relation Let A be a kind. The set Ty Q (A) of types that refines A is given by where is the refinement relation:

Subtyping The subtyping relation is defined by induction on kinds.

Type Environments A (finite) map from variables to sets of types (or intersection types).

Typing rules

Fact: Invariance under βη-equivalence Suppose that M = βη N. Then This fact will not be used in the sequel.

Convention: Subtyping closure In what follows, sets of types are assumed to be closed under the subtyping relation. Now posets of types are simply defined by: where (cf. X Y implies X Y)

Convention: Subtyping closure In what follows, sets of types are assumed to be closed under the subtyping relation. The rule for variables becomes simpler.

Outline Negations in type systems for the call-by-name λ -calculus Target language Affirmative System Negative System the call-by-name λ -calculus + recursion Semantic analysis Discussions

Negative Type System Negative types are those constructed from the negative ground types : Typing rules are the same as the affirmative system.

Negation of a type We define the two anti-monotone bijections on types as follows:

Negation

Natural

Natural

Natural

Negation of a type We define the two anti-monotone bijections on types as follows:

Negation of a type We define the two anti-monotone bijections on types as follows:

Main Theorem Theorem if and only if, where Let. Then Proof) By mutual induction on the structure of the term.

Main Theorem Theorem if and only if, where Let. Then Proof) By mutual induction on the structure of the term. under a certain condition

Outline Negations in type systems for the call-by-name λ -calculus the call-by-name λ -calculus + recursion Semantic analysis Discussions

λ + Recursion Term: Equational theory:

Recursion Rule in Affirmative System The rule for recursion is given by: This is a co-inductive rule: a derivation can be infinite.

Recursion Rule in Negative System The rule for recursion is given by: This is a inductive rule: a derivation must be finite.

Main Theorem Lemma Theorem if and only if. Let. Then

Outline Negations in type systems for the call-by-name λ -calculus the call-by-name λ -calculus + recursion Semantic analysis Discussions

Category ScottL u Definition The category ScottL u is given by: Object Poset (A, A ). Morphism An upward-closed relation Composition Let. Then

Interpretation of CbN λ in ScottL u Fact ScottL u is a cartesian closed category. Interpretation of kinds is given by: Hence. Fact (see e.g. [Terui 2012])

Negation Functor on ScottL u The functor φ: ScottL u ScottL u is defined by: Lemma φ is an isomorphism on ScottL u. If R u A op B and A =, then which is essentially the complement of R.

Outline Negations in type systems for the call-by-name λ -calculus the call-by-name λ -calculus + recursion a call-by-value language + nondeterminism Semantic analysis Discussions

Automata complementation Corresponds to negation of a 2nd-order judgement.

Boolean Closedness of Types Let A be a kind and B A be the set of all Böhm trees of type A. A language is a subset of B A. Definition A language L B A is type-definable if there exists a type τ such that in the type system for higher-order model checking [Kobayashi&Ong 09] [T&Ong 14]. Corollary The class of type-definable languages are closed under Boolean operations on sets.

Further Applications The technique presented in this talk is applicable to: the type system for the full higher-order modelchecking [Kobayashi&Ong 09] a type system witnessing call-by-value reachability [T&Kobayashi 14] a dependent intersection type system in [Kobayashi+ 11], via the translation of dependent types to intersection and union types

Consistency and Inconsistency The negation of a "small" type can be very large. So the negation may not be efficiently computable. The notion of consistency and inconsistency may be useful in the practical use: Definition Let and. They are consistent if and inconsistent otherwise. Proposition If τ and σ are inconsistent, then

Inductive Definition of Consistency Inductive definition of inconsistency is now trivial.

Related Work "Krivine machines and higher-order schemes" [Salvati&Walkiewicz 12] The notion of consistency and inconsistency can be found in their work (called complementarity for the former and the latter has no name). This talk is partially inspired by their work.

Conclusion Negation is a definable operation in the refinement intersection type system for the call-by-name λ. This observation leads to the construction of negative type systems for other refinement type systems, e.g., call-by-name λ + recursion the type system for HOMC a type system for a call-by-value language Application to verification needs some work.