06.03.2014 Views

Book of Abstracts - IRIT

Book of Abstracts - IRIT

Book of Abstracts - IRIT

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

to be executed with the help <strong>of</strong> what we call a prophecy. The decision procedure is compiled<br />

into an impure programming language (OCaml) with an efficient computational model which<br />

performs all the effectful computations. The compilation maps the computations <strong>of</strong> the monad<br />

in Coq, to effectful terms <strong>of</strong> OCaml; it also instruments the code to compute a small piece <strong>of</strong><br />

information to efficiently simulate a converging reduction <strong>of</strong> the compiled code in Type Theory,<br />

using the initial monadic decision procedure. Finally, a relation <strong>of</strong> a posteriori simulation stands<br />

between the compiled term Cptq and the initial monadic term t.<br />

To formalise this idea in a general way, we have studied a concept <strong>of</strong> a posteriori simulation<br />

<strong>of</strong> effectful computations in Type Theory. Roughly speaking, given a computation C <strong>of</strong><br />

type M A, we determine on which conditions there exists a piece <strong>of</strong> information p such that<br />

the evaluation <strong>of</strong> C using p can witness an inhabitant <strong>of</strong> type A. Intuitively, if a compiled<br />

computation Cptq converges to a value v, then the same evaluation can be simulated a posteriori<br />

in Coq using some prophecy p. This prophecy completes the computation to get a<br />

reduced one “ó p t” convertible to “unit t 1 ”, for some term t 1 <strong>of</strong> type T. The formalization <strong>of</strong> the<br />

principle <strong>of</strong> a posteriori simulation focuses on simply typed λ-calculus. On the one hand, we<br />

define λ, a purely functional and strongly normalizing programming language parameterized<br />

by a monad M, which is abstractly specified by a set <strong>of</strong> requirements. On the other hand, we<br />

define λ v,K, an impure functional and non-terminating programming language. The language<br />

λ includes the usual monadic combinators for effects in the spirit <strong>of</strong> [5] and two unusual expressions:<br />

the constant ó and the type constructor P for prophecies. The role <strong>of</strong> ó is to perform a<br />

posteriori simulation, therefore we read ó p t <strong>of</strong> type M T as “the reduced computation <strong>of</strong> t using<br />

the prophecy p”. This reduction remains as a computation, so ó has type P Ñ M T Ñ M T.<br />

The type constructor M, used as a parameter for λ, is a simulable monad if the simulation<br />

<strong>of</strong> effectful constants c converges thanks to the prophecies obtained during execution <strong>of</strong> the<br />

compilation <strong>of</strong> c. The main theorem relates small-step semantics <strong>of</strong> λ and big-step semantics<br />

<strong>of</strong> λ v,K: let ¤ $ t : MT be a computation which compilation converges to a value and produces a<br />

prophecy p 1 , then there exists a term t 1 such that ó p<br />

1 t t 1 .<br />

There is a prototype plugin 1 for Coq to develop pro<strong>of</strong>s using the method we described.<br />

The monad includes the effectful operations <strong>of</strong> partiality, non-termination, state and printing.<br />

Also the non-determinism can be programmed on top <strong>of</strong> the monad. Its type definition is<br />

parameterized by a signature to type the memory operations: M Σ α State.t Σ Ñ pα<br />

stringq ¢ State.t Σ. We keep the power <strong>of</strong> the dependently-typed system <strong>of</strong> Coq despite the fact<br />

that we are working in a monad. Using this proposal <strong>of</strong> pro<strong>of</strong> by reflection we also get a great<br />

performance, gained for type-checking. This is an ongoing work, our long-term goal is to build<br />

upon this system to use Coq as a typed tactic language for Coq.<br />

References<br />

[1] Guillaume Claret, Lourdes del Carmen González Huesca, Yann Régis-Gianas, and Beta Ziliani.<br />

Lightweight pro<strong>of</strong> by reflection using a posteriori simulation <strong>of</strong> effectful computation. Technical<br />

report, 2013. https://gforge.inria.fr/frs/download.php/32051/coqbottom-techreport.pdf.<br />

[2] John Harrison. Metatheory and reflection in theorem proving: A survey and critique. Technical<br />

Report CRC-053, SRI Cambridge, Millers Yard, Cambridge, UK, 1995.<br />

[3] Dimitri Hendriks. Pro<strong>of</strong> reflection in coq. Journal <strong>of</strong> Automated Reasoning, 29(3-4):277–307, 2002.<br />

[4] Martijn Oostdijk and Herman Geuvers. Pro<strong>of</strong> by computation in the coq system. In Theoretical<br />

Computer Science, pages 293–314. Elsevier, 2000.<br />

[5] Philip Wadler. Comprehending monads. Mathematical Structures in Computer Science, 2(4):461–<br />

493, 1992.<br />

1 http://coqbottom.gforge.inria.fr<br />

41

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!