1 / 8

Agate: an Agda -to- Haskell compiler

Agate: an Agda -to- Haskell compiler. AIST / CVS Hiroyuki Ozaki (joint work with Makoto Takeyama). What is Agda?. Proof assistant based on Martin-L ö f type theory. Curry-Howard correspondence available for its core language

tamber
Download Presentation

Agate: an Agda -to- Haskell compiler

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Agate:an Agda-to-Haskell compiler AIST / CVS Hiroyuki Ozaki (joint work with Makoto Takeyama)

  2. What is Agda? • Proof assistant based on Martin-Löf type theory. • Curry-Howard correspondence available for its core language ⇒ Proof language can be regarded as a functional programming language withdependent types. • Full language contains extension of packages, classes (therefore, monads), hidden arguments, metavariables, etc.

  3. Goal • To provide a tool for experimentation of programming with dependent types. • To achieve it, we need • implement the tool quickly • reasonably fast execution of the emitted code • deal with “side effects,” such as I/O.

  4. Requirements • Treat full Agda language • use parser of the current Agda implementation • Faster execution • compile, rather than interpret! • Quick implementation • make the target language be Haskell • Agda language is close to it and there is GHC which generates executable binaries of high quality • use Higher Order Abstract Syntax • to eliminate coding for variable substitution

  5. data Val = VAbs (Val -> Val) | VCon String [Val] | VStr [(String, Val)] | VIO (IO Val) | VString String apply :: Val -> Val -> Val apply (VAbs f) v = f v select :: Val -> String -> Val select (VStr bs) x = lookup x bs E.g., (∖x -> x) zero⇨ VAbs (∖x -> x) `apply` (VCon “zero” []) struct { inc = ∖x -> succ x; n = inc zero } ⇨let inc = VAbs (∖x -> succ `apply` x) n = inc `apply` zero in VStr [(“n”,n),(“inc”,inc)] Our HOAS Tree Untyped lambda calculus for representing Agda terms

  6. How to deal with IO Pass the buck to Haskell! posutulate IO :: Set -> Set posutulate putStr :: String -> IO Unit main :: IO Unit main = putStr “Hello World” x_main, x_putStr :: Val x_main = x_putStr `apply` VString “Hello World” x_putStr = VAbs (∖v -> VIO (putStr (deString v) >> return VUnit )) main :: IO Val main = deIO x_main data Val = … | VIO (IO Val) | VString String deIO (VIO m) = m deString (VString s) = s

  7. Performance GHC : Agate = 1 : 6 (execution time)

  8. Conclusion • FULL dependently typed functional language including IO, with a very sophisticated development environment • Running under Linux, Windows and MacOSX • Visit my homepage to download Agate! http://staff.aist.go.jp/hiroyuki.ozaki/ Availability

More Related