Start of topic | Skip to actions

COMP 617S07: (2007_02_07)

Scribe: Angela Yun Zhu Date: 2007-03-28

Extraction of OCaml code from coq

out goal is to extract Ocaml code in coq, while preserving type safety in the coq program. Axioms allow us to define functions in coq that we can specify later.

Say we have Ocaml_int

Ext Axiom OCamlInt: Set
      Recursive Extraction OCamlInt
      - type oCamlInt

      Axiom Num5: OCamInt
      -let Num5=

When extracting prop, set, type becomes OCaml types. Things that have something that is prop, set, or type become let sratements (ocaml values)

We can specify what the extracted code looks like with "Extract"

Ex cont....
Extract Constant OCamlInt => "int"
      ~> type OCamlInt = int

Alternative extraction routine

 Extraction "file.ml" func1 type2

In concoqtion, we define the following:

Inductive OCamlType := 
   | OCaml_int
   | OCaml_unit
   | ...

This causes problems because OCaml_int extracts to a OCaml value (Not a type).

For references we define

Axiom OCamllet : Set -> Set.
Extract Constant OCamlref "a" -> "a ref"

changes to interpreter from concoqtion to coq:

eval E and evalT do NOT have return type OCamlType?, They have return type set

Some tricks: to get Ocaml functions

Axiom OCamlfst:
   forall a b :set, (Ocaml tuple a b) ->a

Extract Constant Ocaml_fst => "fun x -> fst x"

Current problem :

Var 0 et => OCaml_sft env
Does not typecheck
    env: Eval e
We need env: OCamlTuple

Fixpoint eval (e:Env) (t: Typ) (exp: tterm e t) ( env: evalE e): (evalT t)


End of topic
Skip to actions | Back to top
Creative Commons LicenseThis work is licensed under a Creative Commons Attribution 2.5 License. Please follow our citation guidelines.