Coq on iPad - keigoi/coq4ipad- ¢  Mac OS X Lion (10.7), latest Xcode (4.6), iPad 2

download Coq on iPad - keigoi/coq4ipad- ¢  Mac OS X Lion (10.7), latest Xcode (4.6), iPad 2

of 14

  • date post

    07-Oct-2020
  • Category

    Documents

  • view

    0
  • download

    0

Embed Size (px)

Transcript of Coq on iPad - keigoi/coq4ipad- ¢  Mac OS X Lion (10.7), latest Xcode (4.6), iPad 2

  • Coq on iPad by Keigo IMAI @keigoi

    Proof Summit 2013 at 多元 503 Nagoya Univ.

    24 Aug, 2013

  • Why Coq on iPad?

    • Prove everywhere! • on a train, in a cafe, or even in your bed!

    • Good for poster sessions (maybe)

    And because there’s excellent OCamlXARM by psellos.com! (OCaml now runs on iOS!)

    http://psellos.com/ocaml/ http://psellos.com/ocaml/

  • History • Dec 2011:

    @mzp put the first Coq-on-iOS implementation public on Github https://github.com/mzp/coq-ide-for-ios/

    • Mar 2012: OCamlXARM (and Card game built by this) is published on the web by Psellos.com

    • Feb 2013: I started this project! (almost complete rewrite from @mzp’s version)

    https://github.com/mzp/coq-ide-for-ios/ https://github.com/mzp/coq-ide-for-ios/ http://psellos.com/ocaml/ http://psellos.com/ocaml/

  • Coq for iPad’s main UI console output

    .v source editor evaluate / roll back

    one step

    eval’d lines are colored blue (like coqide)

    (opens the file browser)

  • The file browser

    List of files • Files are saved as you

    type in the editor

    • Each .v file can’t refer to other files (currently)

    create a new .v file

    delete a file

  • Download / Build

    $ git clone --recursive https://github.com/ keigoi/coq4ios (will also clone OCamlXARM/XSIM, Coq and lzmaSDK repo)

    Prerequisites: Mac OS X Lion (10.7), latest Xcode (4.6), iPad 2 or later (optional), Host OCaml 4.00.1 and Camlp5 6.07

    See README.md for details

    1. Compile & Install OCamlXSIM (ocamlopt for iOS simulator) and Camlp5

    2. Compile Coq *.cma for iOS simulator

    3. Compile Coq *.v files

    4. Compile Coq4iOS (OCaml-part)

    5. Then, open coq4ios.xcodeproj with Xcode, compile & run!

    https://github.com/keigoi/coq4ios https://github.com/keigoi/coq4ios https://github.com/keigoi/coq4ios https://github.com/keigoi/coq4ios https://github.com/keigoi/coq4ios/blob/master/README.md https://github.com/keigoi/coq4ios/blob/master/README.md

  • Idea

    • Multiple file support - Compiling .v on iPad • コンパイルしたファイルをRequire Import できる ように

    • Save proofs on cloud • Download proofs from the web • UI improvements • SSReflect support

  • Issues

    • Heavy proof will hang the whole app

  • UI idea • Shortcut keys to Coq commands

    • ‘move’ symbols by hand ============================ forall P : Prop, P -> P

    P : Prop ============================ P -> P

    tap & move up to premise... or put then back!

  • UI Idea: navigate graphically on the proof tree

    Pic: Proof tree visualization for Proof General, by Hendrik Tews Available from: http://askra.de/software/prooftree/

    http://askra.de/software/prooftree/ http://askra.de/software/prooftree/

  • Inside Coq4iOS

    OCaml part:

    - src/main.ml

    Objective-C (Xcode) part:

    bunch of ObjC files and OCaml/Coq runtime

    binaries

  • OCaml part: (* start Coq (same effect as typing ‘coqtop’ in the shell) *) val start : string -> bool

    (* try to parse the text and returns the range of the next parsable phrase *) val next_phrase_range : string -> int * int

    (* evaluates Coq phrase and returns the console output *) val eval : string -> bool * string

    (* Undo for given steps *) val rewind : int -> int

  • Initializing sequence Coq4iOS uncompress Coq stdlib .vo from coq-8.4pl2-standard-libs-for-coq4ios.7z 30 Mbytes (takes a few minutes,

    first time only)

    Call caml_main (in C) which initializes all OCaml modules

    Run Coqtop.init_toplevel (in OCaml)

    Eval phrase / Undo / ... on Coq

    (OCaml part runs in a separate thread)

    App store limitation: bundle must be < 50 MB

  • Summary

    • An implementation of Coq on iOS (iPad) • Several UI ideas •

    Join us! • Coq for iPad:

    https://github.com/keigoi/coq4ios

    https://github.com/keigoi/coq4ios https://github.com/keigoi/coq4ios