• Aucun résultat trouvé

Chapitre 7, programmes et preuves

Dans ce dernier chapitre, nous considérons des exemples de programmes et de preuves qui peuvent être écrits et manipulés par le prototype que nous avons implanté. Cet ensemble restreint d'exemples n'a pas pour but de présenter le système de manière exhaustive. Ils visent seulement à démontrer l'expressivité du système, à travers une sélection d'exemples. Tous les exemples données dans ce chapitre ont été véri{és par notre prototype à la produc-tion de ce document. Ils sont donc acceptés par notre implémentaproduc-tion sans qu'aucune modi{cation soit nécessaire.

Une partie des exemples considérés concernent les listes, avec certains de leurs sous-types. En particulier, on considère le type des vecteurs (listes de taille {xée) et les listes triées. On démontre ainsi, par exemple, qu'il est possible de reöéter par le typage qu'une fonction de tri (ici le tri par insertion) transforme une liste en une liste triée.

Pour {nir le chapitre, on considère quelque exemples utilisant la logique classique. En particulier, on dé{nit un programme qui est en fait extrait de la preuve classique d'un lemme sur les listes in{nies d'entiers (ou « stream »). On dé{nit ainsi une fonction qui, étant donné une liste in{nie d'entiers, retourne une sous-liste in{nie de nombre pairs, ou une sous-liste in{nie de nombres impairs. Il n'est évidemment pas possible d'écrire un tel programme hors d'un cadre classique.

References

Semi-Continuous Si÷ed Types and Termination, Andreas Abel, Logical Methods in

Computer Science, Volume 4, Number 2.

[Barendregt 1981] The Lambda Calculus - Its Syntax and Semantics, Hendrik P. Barendregt,

North-Holland.

Conception et implémentation d'un système d'aide à la spécizcation et à la preuve de programmes ML, Sylvain Baro, Thèse de l'Université Paris Diderot.

Combining Proofs and Programs in a Dependently Typed Language, Chris

Casinghino, Vilhelm Sjúberg and Stephanie Weirich, proceedings of POPL.

Set-Theoretic Types for Polymorphic Variants, Giuseppe Castagna, Tommaso

Petrucciani and Kim Nguyen, proceedings of ICFP.

Program verizcation through characteristic formulae, Arthur Charguéraud,

proceedings of ICFP.

Characteristic formulae for the verizcation of imperative programs, Arthur

Charguéraud, proceedings of ICFP.

Strict bidirectional type checking, Adam Chlipala, Leaf Petersen and Robert

Harper, proceedings of TLDI.

Some properties of conversion, Alonzo Church and John Barkley Rosser Sr.,

Transactions of the American Mathematical Society, Volume 36, Number 3.

[Church 1941]The Calculi of Lambda-Conversion, Alonzo Church, Annals of Mathematical

Stud-ies, Volume 6.

Implementing Mathematics with the Nuprl proof development system, Robert. L.

Constable, S. F. Allen, H. M. Bromley et al., Prentice Hall.

The Coq Proof Assistant Reference Manual, Coq Development Team, LogiCal

Project.

The Calculus of Constructions, Thierry Coquand and Gérard Huet, Information

and Computation, Volume 76, Issue 2-3.

Principal Type-Schemes for Functional Programs, Luís Damas and Robin Milner,

proceedings of POPL.

Flow - A static type checker for Javascript, Facebook Inc., open source.

Why3 - Where Programs Meet Provers, Jean-Christophe Filliâtre and Andrei

Paskevich, proceedings of ESOP, Lecture Notes in Computer Science, Volume 7792.

The Essence of Compiling with Continuations, Cormac Flanagan, Amr Sabry,

Bruce Duba et al., proceedings of PLDI.

Programming with Polymorphic Variants, Jacques Garrigue, proceedings of the

ML Workshop.

Relaxing the Value Restriction, Jacques Garrigue, proceedings of FLOPS.

[Garrigue 2004] [Garrigue 1998] [Flanagan 1993] [Filliâtre 2013] [Facebook 2014] [Damas 1982] [Coquand 1988] [CoqTeam 2004] [Constable 1986] [Church 1936] [Chlipala 2005] [Chargueraud 2011] [Chargueraud 2010] [Castagna 2016] [Casinghino 2014] [Baro 2003] [Abel 2008]

[Girard 1972]Interprétation fonctionnelle et élimination des coupures de l'arithmétique d'ordre supér-ieur, Jean-Yves Girard, Thèse de l'Université Paris VII.

Proofs and Types, Jean-Yves Girard, Paul Taylor and Yves Lafont, Cambridge

University Press.

A Formulae-as-Types Notion of Control, Timothy G. Grif{n, proceedings of POPL. ML with callcc is unsound, Robert Harper and Mark Lillibridge, Message posted

to the SML mailing list.

Grundlagen der Mathematik I, David Hilbert and Paul Bernays, Grundlehren der

mathematischen Wissenschaùten.

Equality in La÷y Computation Systems, Douglas J. Howe, proceedings of LICS. The Zipper, Gérard Huet, Journal of Functional Programming, Volume 7.

Proving the Correctness of Reactive Systems Using Si÷ed Types, John Hughes, Lars

Pareto and Amr Sabry, proceedings of POPL.

AURA: a Programming Language for Authori÷ation and Audit, L. Jia, J. Vaughan, Karl

Mazurak et al., proceedings of ICFP.

Lambda-calcul, types et modèles, Jean-Louis Krivine, Masson.

A call-by-name lambda-calculus machine, Jean-louis Krivine, Higher Order and

Symbolic Computation.

Reali÷ability in Classical Logic, Jean-Louis Krivine, Panoramas et Synthèses,

Volume 27.

mypy - Optional static typing for Python, Jukka Lehtosalo, Open source project. A Classical Reali÷ability Model for a Semantical Value Restriction, R. Lepigre,

proceedings of ESOP, Lecture Notes in Computer Science, Volume 9632.

Practical Subtyping for System F with Si÷ed (Co-)Induction, Rodolphe Lepigre and

Christophe Ra|falli, Submitted.

Polymorphic Type Inference and Assignment, Xavier Leroy and Pierre Weis, in the

proceedings of POPL.

Polymorphism by Name for References and Continuations, Xavier Leroy, in the

proceedings of POPL.

Positively Dependent Types, Daniel Licata and Robert Harper, in the proceedings

of PLPV.

Modules for Standard ML, David MacQueen, proceedings of LFP.

ProPre A Programming Language with Proofs, Pascal Manoury, Michel Parigot

and Marianne Simonot, Lecture Notes in Computer Science, Volume 624.

Constructive Mathematics and Computer Programming, Per Martin-Lúf, Studies

in Logic the Foundations of Mathematics, Volume 104.

TypeScript - Javascript that scales, Microsoùt, Open source project.

Le Calcul des Constructions Implicites : Syntaxe et Sémantique, Alexandre Miquel,

Thèse de l'Université Paris VII. [Miquel 2001] [Microso{t 2012] [Martin-Löf 1982] [Manoury 1992] [MacQueen 1984] [Licata 2009] [Leroy 1993] [Leroy 1991] [Lepigre 2017] [Lepigre 2016] [Lehtosalo 2014] [Krivine 2009] [Krivine 2007] [Krivine 1990] [Jia 2008] [Hughes 1996] [Huet 1997] [Howe 1989] [Hilbert 1934] [Harper 1991] [Grifzn 1990] [Girard 1989]

Classical Program Extraction in the Calculus of Constructions, Alexandre Miquel,

proceedings of CSL.

Existential witness extraction in classical reali÷ability and via a negative translation,

Alexandre Miquel, Logical Methods in Computer Science.

An Extension of System F with Subtyping, L. Cardelli, S. Martini, J. C. Mitchell

et al., proceedings of TACS.

Foundations for Programming Languages, John C. Mitchell, MIT Press.

Computational Lambda-Calculus and Monads, Eugenio Moggi, in the proceedings

of LICS.

Focalisation and Classical Realisability, Guillaume Munch-Maccagnoni, in the

proceedings of CSL.

Dependently Typed Programming in Agda, Ulf Norell, Lecture notes from the

Summer School in Advanced FP.

PVS: Combining Specizcation, Proof Checking and Model Checking, S. Owre, S. Rajan,

J. Rushby et al., Lecture Notes In Computer Science.

Lambda-Mu-calculus: an algorithmic interpretation of classical natural deduction,

Michel Parigot, proceedings of LPAR.

System F-eta, Christophe Ra|falli.

An optimi÷ed complete semi-algorithm for system F-eta, Christophe Ra|falli. Towards a Theory of Type Structure, John C. Reynolds, proceedings Colloque

sur la Programmation.

Des types aux assertions logiques : preuve automatique ou assistée de propriétés sur les programmes fonctionnels, Yann Régis-Gianas, Thèse de l'Université Paris Diderot.

Secure Distributed Programming with Value-Dependent Types, Nikhil Swamy, Juan

Chen, C. Fournet et al., proceedings of ICFP.

TIL: A Type-Directed Optimi÷ing Compiler for ML, D. Tarditi, G. Morrisett, P.

Cheng et al., proceedings of PLDI.

The Subtyping Problem for Second-Order Types is Undecidable, Jerzy Tiuryn and

Pawel Urzyczyn, Proceedings of LICS.

The Subtyping Problem for Second-Order Types is Undecidable, Jerzy Tiuryn and

Pawel Urzyczyn, Information and Computation, Volume 179.

Type Inference for Polymorphic References, Mads Toùte, Information and

Compu-tation, Volume 89, Issue 1.

Computability and Lambda-Deznability, Alan Turing, Journal of Symbolic Logic. Call-by-value is dual to call-by-name, Philip Wadler, SIGPLAN Notices 38(9). Typability and Type-Checking in the Second-Order lambda-Calculus are Equivalent and Undecidable, Joe B. Wells, Proceedings of LICS.

Typability and type checking in System F are equivalent and undecidable, Joe B. Wells,

Annals of Pure and Applied Logic, Volume 98. [Wells 1999] [Wells 1994] [Wadler 2003] [Turing 1937] [To{te 1990] [Tiuryn 2002] [Tiuryn 1996] [Tarditi 1996] [Swamy 2011] [Régis-Gianas 2007] [Reynolds 1974] [Ra|falli 1999] [Ra|falli 1998] [Parigot 1992] [Owre 1996] [Norell 2008] [Munch 2009] [Moggi 1989] [Mitchell 1996] [Mitchell 1991] [Miquel 2011] [Miquel 2007]

A Syntactic Approach to Type Soundness, A. K. Wright and M. Felleisen,

Infor-mation and Computation, Volume 15, Issue 1.

Simple Imperative Polymorphism, Andrew K. Wright, Lisp and Symbolic

Compu-tation, Volume 8, Number 4.

Dependent Types in Practical Programming, Hongwei Xi and Frank Pfenning, in the

proceedings of POPL.

Applied Type System: Extended Abstract, Hongwei Xi, proceedings of TYPES. On the Relation between the Lambda-Mu-Calculus and the Syntactic Theory of Sequential Control, Philippe de Groote, Lecture Notes in Computer Science.

[de Groote 1994] [Xi 2003] [Xi 1999] [Wright 1995] [Wright 1994]

Résumé

Au cours des dernières années, les assistants de preuves on fait des progrès considérables et ont atteint un grand niveau de maturité. Ils ont permit la certi{cation de programmes complexes tels que des compilateurs et même des systèmes d'exploitation. Néanmoins, l'utilisation d'un assistant de preuve requiert des compétences techniques très particulières, qui sont très éloignées de celles requises pour programmer de manière usuelle. Pour combler cet écart, nous entendons concevoir un langage de programmation de style ML supportant la preuve de programmes. Il combine au sein d'un même outil la öexibilité de ML et le {n niveau de spéci{cation o|fert par un assistant de preuve. Autrement dit, le système peut être utilisé pour programmer de manière fonctionnelle et fortement typée tout en autorisant l'obtention de nouvelles garanties au besoin.

On étudie donc un langage en appel par valeurs dont le système de type étend une logique d'ordre supérieur. Il comprend un type égalité entre les programmes non typés, un type de fonction dépendant, la logique classique et du sous-typage. La combinaison de l'appel par valeurs, des fonctions dépendantes et de la logique classique est connu pour poser des problèmes de cohérence. Pour s'assurer de la correction du système (cohérence logique et süreté à l'exécution), on propose un cadre théorique basé sur la réalisabilité classique de Krivine. Le modèle repose sur une propriété essentielle qui lie les di|férent niveaux d'interprétation des types d'une manière novatrice.

On démontre aussi l'expressivité de notre système en se basant sur son implantation dans un prototype. Il peut être utilisé pour prouver des propriétés de programmes standards tels que

la fonction « map » sur les listes ou le tri par insertion....

Abstract

In recent years, proof assistant have reached an impressive level of maturity. They have led to the certi{cation of complex programs such as compilers and operating systems. Yet, using a proof assistant requires highly specialised skills and it remains very di|ferent from standard program-ming. To bridge this gap, we aim at designing an ML-style programming language with support for proofs of programs, combining in a single tool the öexibility of ML and the {ne speci{cation features of a proof assistant. In other words, the system should be suitable both for programming (in the strongly-typed, functional sense) and for gradually increasing the level of guarantees met by programs, on a by-need basis.

We thus de{ne and study a call-by-value language whose type system extends higher-order logic with an equality type over untyped programs, a dependent function type, classical logic and subtyping. The combination of call-by-value evaluation, dependent functions and classical logic is known to raise consistency issues. To ensure the correctness of the system (logical consistency and runtime safety), we design a theoretical framework based on Krivine's classical realizability. The construction of the model relies on an essential property linking the di|ferent levels of interpre-tation of types in a novel way.

We {nally demonstrate the expressive power of our system using our prototype implementa-tion, by proving properties of standard programs like the map function on lists or the insertion sort.

Documents relatifs