Table Of ContentLecture Notes in Computer Science 5497
CommencedPublicationin1973
FoundingandFormerSeriesEditors:
GerhardGoos,JurisHartmanis,andJanvanLeeuwen
EditorialBoard
DavidHutchison
LancasterUniversity,UK
TakeoKanade
CarnegieMellonUniversity,Pittsburgh,PA,USA
JosefKittler
UniversityofSurrey,Guildford,UK
JonM.Kleinberg
CornellUniversity,Ithaca,NY,USA
AlfredKobsa
UniversityofCalifornia,Irvine,CA,USA
FriedemannMattern
ETHZurich,Switzerland
JohnC.Mitchell
StanfordUniversity,CA,USA
MoniNaor
WeizmannInstituteofScience,Rehovot,Israel
OscarNierstrasz
UniversityofBern,Switzerland
C.PanduRangan
IndianInstituteofTechnology,Madras,India
BernhardSteffen
UniversityofDortmund,Germany
MadhuSudan
MassachusettsInstituteofTechnology,MA,USA
DemetriTerzopoulos
UniversityofCalifornia,LosAngeles,CA,USA
DougTygar
UniversityofCalifornia,Berkeley,CA,USA
GerhardWeikum
Max-PlanckInstituteofComputerScience,Saarbruecken,Germany
Stefano Berardi Ferruccio Damiani
Ugo de’Liguoro (Eds.)
Types for Proofs
and Programs
International Conference, TYPES 2008
Torino, Italy, March 26-29, 2008
Revised Selected Papers
1 3
VolumeEditors
StefanoBerardi
FerruccioDamiani
Ugode’Liguoro
UniversitàdiTorino,DipartimentodiInformatica
CorsoSvizzera185,10149Torino,Italy
E-mail:{stefano,damiani,deligu}@di.unito.it
LibraryofCongressControlNumber:Appliedfor
CRSubjectClassification(1998):F.3.1,F.4.1,D.3.3,I.2.3
LNCSSublibrary:SL1–TheoreticalComputerScienceandGeneralIssues
ISSN 0302-9743
ISBN-10 3-642-02443-2SpringerBerlinHeidelbergNewYork
ISBN-13 978-3-642-02443-6SpringerBerlinHeidelbergNewYork
Thisworkissubjecttocopyright.Allrightsarereserved,whetherthewholeorpartofthematerialis
concerned,specificallytherightsoftranslation,reprinting,re-useofillustrations,recitation,broadcasting,
reproductiononmicrofilmsorinanyotherway,andstorageindatabanks.Duplicationofthispublication
orpartsthereofispermittedonlyundertheprovisionsoftheGermanCopyrightLawofSeptember9,1965,
initscurrentversion,andpermissionforusemustalwaysbeobtainedfromSpringer.Violationsareliable
toprosecutionundertheGermanCopyrightLaw.
springer.com
©Springer-VerlagBerlinHeidelberg2009
PrintedinGermany
Typesetting:Camera-readybyauthor,dataconversionbyScientificPublishingServices,Chennai,India
Printedonacid-freepaper SPIN:12697175 06/3180 543210
Preface
These proceedings contain a selection of refereed papers presented at or re-
lated to the Annual Workshop of the TYPES project (EU coordination action
510996), which was held during March 26–29, 2008 in Turin, Italy. The topic
of this workshop, and of all previous workshops of the same project, was for-
malreasoningandcomputer programmingbasedontype theory:languagesand
computerized tools for reasoning, and applications in several domains such as
analysis of programming languages, certified software, mobile code, formaliza-
tion of mathematics, mathematics education. The workshop was attended by
more than 100 researchers and included more than 40 presentations. We also
had three invited lectures, from A. Asperti (University of Bologna), G. Dowek
(LIX, Ecole polytechnique, France) and J. W. Klop (Vrije Universiteit, Ams-
terdam, The Netherlands). From 27 submitted papers, 19 were selected after
a reviewing process. Each submitted paper was reviewed by three referees; the
final decisions were made by the editors. This workshop is the last of a series
of meetings of the TYPES working group funded by the European Union (IST
project 29001, ESPRIT Working Group 21900, ESPRIT BRA 6435). The pro-
ceedings of these workshops were published in the Lecture Notes in Computer
Science series:
TYPES 1993 Nijmegen, The Netherlands, LNCS 806,
TYPES 1994 B˚astad, Sweden, LNCS 996,
TYPES 1995 Turin, Italy, LNCS 1158,
TYPES 1996 Aussois, France, LNCS 1512,
TYPES 1998 Kloster Irsee, Germany, LNCS 1657,
TYPES 1999 L¨okeborg, Sweden, LNCS 1956,
TYPES 2000 Durham, UK, LNCS 2277,
TYPES 2002 Berg en Dal, The Netherlands, LNCS 2646,
TYPES 2003 Turin, Italy, LNCS 3085,
TYPES 2004 Jouy-en-Josas,France, LNCS 3839,
TYPES 2006 Nottingham, UK, LNCS 4502,
TYPES 2007 Cividale del Friuli, Italy, LNCS 4941.
ESPRIT BRA 6453wasa continuationof ESPRIT Action 3245,Logical Frame-
works: Design, Implementation and Experiments. TYPES 2008 was made pos-
sible by the contribution of many people. We thank all the participants of the
workshops,andalltheauthorswhosubmittedpapersforconsiderationforthese
proceedings.Wewouldliketoalsothanktherefereesfortheireffortinpreparing
careful reviews.
March 2009 Stefano Berardi
Ferruccio Damiani
Ugo de’Liguoro
Organization
Referees
A. Abel G. Dowek J.-F. Monin
J. Adamek C. Dubois A. Murawski
T. Altenkirch A. Felty K. Nakazawa
D. Ancona J.-C. Filliatre R. O’Connor
F. Aschieri C. Fuhs N. Oury
A. Asperti M. Gebser M. Piccolo
J. Avigad M. Gelfond A. Poetzsch-Heffter
F. Barbanera H. Geuvers L. Pottier
E. Beffara G. Gupta C. Raffalli
S. Berghofer J. Harrison F. Ricca
Y. Bertot T. Hoang W. Ricciotti
F. Besson M. Hofmann E. Ritter
L. Bettini B. Jacobs L. Robaldo
S. B. Ana D. Kesner P. Rudnicki
B. E. Brady E. Komendantskaya A. Saurin
J. Caldwell J. Laird A. Setzer
F. Cardone S. Lengrand E. Tassi
P. Casteran M. Lenisa K. Terui
J. Charles P. B. Levy L. Thery
A. Chlipala R. Matthes A. Trybulec
A. Ciaffaglione D. Mazza T. Uustalu
M. Comini C. Mcbride F.-J. de Vries
T. Coquand J. McKinna R. de Vrijer
P. Corbineau M. Miculan H. Zantema
U. Dal Lago D. Miller
D. de Carvalho A. Miquel
Table of Contents
Type Inference by Coinductive Logic Programming................... 1
Davide Ancona, Giovanni Lagorio, and Elena Zucca
About the Formalization of Some Results by Chebyshev in Number
Theory ......................................................... 19
Andrea Asperti and Wilmer Ricciotti
A New Elimination Rule for the Calculus of Inductive Constructions ... 32
Bruno Barras, Pierre Corbineau, Benjamin Gr´egoire,
Hugo Herbelin, and Jorge Luis Sacchini
A Framework for the Analysis of Access Control Models for Interactive
Mobile Devices .................................................. 49
Juan Manuel Crespo, Gustavo Betarte, and Carlos Luna
Proving Infinitary Normalization................................... 64
Jo¨rg Endrullis, Clemens Grabmayer, Dimitri Hendriks,
Jan Willem Klop, and Roel de Vrijer
First-Class Object Sets ........................................... 83
Erik Ernst
Monadic Translation of Intuitionistic Sequent Calculus................ 100
Jos´e Esp´ırito Santo, Ralph Matthes, and Lu´ıs Pinto
Towards a Type Discipline for Answer Set Programming.............. 117
Camillo Fiorentini, Alberto Momigliano, and Mario Ornaghi
Type Inference for a Polynomial Lambda Calculus ................... 136
Marco Gaboardi and Simona Ronchi Della Rocca
Local Theory Specifications in Isabelle/Isar ......................... 153
Florian Haftmann and Makarius Wenzel
Axiom Directed Focusing ......................................... 169
Cl´ement Houtmann
A Type System for Usage of Software Components ................... 186
Dag Hovland
Merging Procedural and Declarative Proof .......................... 203
Cezary Kaliszyk and Freek Wiedijk
Using Structural Recursion for Corecursion.......................... 220
Yves Bertot and Ekaterina Komendantskaya
VIII Table of Contents
Manifest Fields and Module Mechanisms in Intensional Type Theory ... 237
Zhaohui Luo
AMachine-CheckedProofoftheAverage-CaseComplexityofQuicksort
in Coq.......................................................... 256
Eelis van der Weegen and James McKinna
Coalgebraic Reasoning in Coq: Bisimulation and the λ-Coiteration
Scheme ......................................................... 272
Milad Niqui
A Process-Modelfor Linear Programs .............................. 289
Luca Paolini and Mauro Piccolo
Some Complexity and Expressiveness Results on Multimodal and
Stratified Proof Nets ............................................. 306
Luca Roversi and Luca Vercelli
Author Index.................................................. 323
Type Inference
(cid:2)
by Coinductive Logic Programming
Davide Ancona, Giovanni Lagorio,and Elena Zucca
DISI,Univ.of Genova, v.Dodecaneso 35, 16146 Genova, Italy
{davide,lagorio,zucca}@disi.unige.it
Abstract. We propose a novel approach to constraint-based type in-
ferencebasedoncoinductivelogic.Constraintgenerationcorrespondsto
translation into a conjunction of Horn clauses P, and constraint satis-
faction is defined in terms of the coinductive Herbrand model of P. We
illustrate the approach by formally defining this translation for a small
object-oriented language similar to Featherweight Java, where type an-
notations in field and method declarations can be omitted.
In this way, we obtain a very precise typeinference and provide new
insightsintothechallengingproblemoftypeinferenceforobject-oriented
programs.Sincetheapproachisdeliberatelydeclarative,wedefineinfact
a formal specification for a general class of algorithms, which can be a
useful road map to researchers.
Furthermore, despite we consider here a particular language, the
methodology could be used in general for providing abstract specifica-
tions of typeinference for different kindsof programming languages.
Keywords:Typeinference,coinduction,nominalandstructuraltyping,
object-oriented languages.
1 Introduction
Typeinferenceisavaluablemethodtoensurestaticguaranteesontheexecution
of programs (like the absence of some type errors) and to allow sophisticated
compiler optimizations. In the context of object-oriented programming, many
solutions have been proposed to perform type analysis (we refer to the recent
articleofWangandSmith[20]foracomprehensiveoverview),buttheincreasing
interestindynamicobject-orientedlanguagesisaskingforevenmorepreciseand
efficient type inference algorithms [3,14].
Two important features which have to be supported by type inference are
parametric anddata polymorphism [1];theformerallowsinvocationofamethod
on arguments of unrelated types, the latter allows assignment of values of unre-
lated types to a field. While most solutions proposed in literature support well
parametric polymorphism, only few inference algorithms are able to deal prop-
erly with data polymorphism; such algorithms, however, turn out to be quite
complex and cannot be easily described.
(cid:2) This work has been partially supported by MIUR EOS DUE - Extensible Object
Systemsfor Dynamicand Unpredictable Environments.
S.Berardi,F.Damiani,andU.de’Liguoro(Eds.):TYPES2008,LNCS5497,pp.1–18,2009.
(cid:2)c Springer-VerlagBerlinHeidelberg2009
2 D. Ancona, G. Lagorio, and E. Zucca
In this paper we propose a novel approach to type inference, by exploiting
coinductive logic programming. Our approach is deliberately declarative, that
is, we do not define any algorithm,but rather try to capture a space of possible
solutions to the challenging problem of precise type inference of object-oriented
programs.
The basic idea is that the program to be analyzed can be translated into an
approximatinglogicprogramandagoal;then,typeinferencecorrespondstofind
an instantiation of the goal which belongs to the coinductive model of the logic
program.Coinduction allows to deal in a naturalway with both recursive types
[11,12] and mutually recursive methods.
The approach is fully formalized for a purely functional object-oriented lan-
guagesimilartoFeatherweightJava[16],wheretypeannotationscanbeomitted,
and are used by the programmer only as subtyping constraints. The resulting
type inference is very powerful and allows, for instance, very precise analysis of
heterogeneous container objects (as linked lists).
Thepaperisstructuredasfollows:Section2definesthelanguageandgivesan
informalpresentationofthetypesystem,basedonstandardrecursiveandunion
types.InSection3thetypesystemisreconsideredinthelightofcoinductivelogic
programming,andthe translationis fully formalized.Type soundness w.r.t.the
operational semantics is claimed (proofs are sketched in Appendix B). Finally,
Section 4 draws some conclusions and discusses future developments.
2 Language Definition and Types
In this section we present a simple object-oriented (shortly OO) language to-
gether with the definition of types. Constraint generation and satisfaction are
only informally illustrated; they will be formally defined in the next section, on
top of coinductive logic programming.
2.1 Syntax and Operational Semantics
The syntax is given in Figure 1. Syntactic assumptions listed in the figure are
verified before performing type inference. We use bars for denoting sequences:
for instance, em denotes e1,...,em, T xn denotes1 T1 x1,...,Tn xn, and so on.
The language is basically Featherweight Java (FJ) [16], a small Java subset
which has become a standard example to illustrate extensions and new tech-
nologies for Java-like languages. Since we are interested in type inference, type
annotations for parameters,fields, and returned values can be omitted; further-
more, to make the type inference problem more interesting, we have introduced
theconditionalexpressionif (e) e else e ,andamoreexpressiveformofcon-
1 2
structor declaration.
We assume countably infinite sets of class names c, method names m, field
names f,andparameter names x.Aprogramis a sequenceofclass declarations
1 If not explicitly stated, thebar “distributes over” all meta-variables below it.