GithubHelp home page GithubHelp logo

kevindadi / coq2rust Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pirapira/coq2rust

0.0 0.0 0.0 36.94 MB

Coq to Rust program extraction. The whole tree is on the original Coq code base.

License: GNU Lesser General Public License v2.1

Emacs Lisp 0.03% Makefile 0.16% Shell 0.12% OCaml 48.38% TeX 10.19% CSS 0.04% Coq 40.67% C 0.36% C++ 0.04% Verilog 0.01%

coq2rust's Introduction

coq2rust

See input.v for examples of extracted Coq terms.

try

$ ./configure -local
$ ./compile.sh

at the directory containing this file. After this, test.rs will contain the extracted code like this:

enum Empty_set<> {
 
}


enum Unit<> {
 Tt
}


enum Bool<> {
 True,
 False
}


fn xorb(b1: Bool, b2: Bool) -> Bool {
  match b1 {
  Bool::True =>
    (match b2 {
     Bool::True => Bool::False,
     Bool::False => Bool::True
     }),
  Bool::False => b2
  }
}

enum Nat<> {
 O,
 S(Box<Nat>)
}


enum Prod< a, b> {
 Pair(Box<a>, Box<b>)
}


fn fst<p,a2>(p: Prod<p,a2>) -> p { match p {
Prod::Pair(box x,box y) => x
} }

enum List< a> {
 Nil,
 Cons(Box<a>, Box<(List<a>)>)
}


fn app<m0>(l: List<m0>, m0: List<m0>) -> List<m0> {
  match l {
  List::Nil => m0,
  List::Cons(box a,box l1) => List::Cons((box () a), (box () (app (l1,m0))))
  }
}

fn add(n0: Nat, m0: Nat) -> Nat {
  match n0 {
  Nat::O => m0,
  Nat::S(box p) => Nat::S((box () (add (p,m0))))
  }
}

fn n() -> Unit {
  Unit::Tt
}

fn m() -> Bool {
  Bool::True
}

enum Emp<> {
 
}


type Single =
  Unit;
  // singleton inductive, whose constructor was s
  
fn o() -> Single {
  Unit::Tt
}

enum Double<> {
 D0(Box<Unit>),
 D1
}


fn d() -> Double {
  Double::D0((box () Unit::Tt))
}

fn e() -> Double {
  Double::D1
}

enum Two_arg<> {
 Ta(Box<Unit>, Box<Unit>)
}


fn tv() -> Two_arg {
  Two_arg::Ta((box () Unit::Tt), (box () Unit::Tt))
}

fn num() -> Nat {
  Nat::S((box () (Nat::S((box () Nat::O)))))
}

fn f(d0: Double) -> Unit {
  Unit::Tt
}

fn g(d0: Double) -> Double { match d0 {
Double::D0(box u) => Double::D1,
Double::D1 => Double::D0((box () Unit::Tt))
} }

enum Even<> {
 O0,
 Eo(Box<Odd>)
}

enum Odd<> {
 Oe(Box<Even>)
}

Below is the original Coq README

           	         THE COQ V8 SYSTEM
        	         =================

INSTALLATION.

See the file INSTALL for installation procedure.

DOCUMENTATION.

The documentation is part of the archive in directory doc. The documentation of the last released version is available on the Coq web site at http://coq.inria.fr/doc.

CHANGES.

There is a file named CHANGES that explains the differences and the incompatibilities since last versions. If you upgrade Coq, please read it carefully.

AVAILABILITY.

Coq is available from http://coq.inria.fr.

THE COQ CLUB.

The Coq Club moderated mailing list is meant to be a standard way to discuss questions about the Coq system and related topics. The subscription link can be found at http://coq.inria.fr/community.

The topics to be discussed in the club should include:

 * technical problems;

 * questions about proof developments;

 * suggestions and questions about the implementation;

 * announcements of proofs;

 * theoretical questions about typed lambda-calculi which are
   closely related to Coq.

For any questions/suggestions about the Coq Club, please write to [email protected].

BUGS REPORT.

Send your bug reports by filling a form at

    http://coq.inria.fr/bugs

To be effective, bug reports should mention the Caml version used to compile and run Coq, the Coq version (coqtop -v), the configuration used, and include a complete source example leading to the bug.

coq2rust's People

Contributors

herbelin avatar letouzey avatar mattam82 avatar ppedrot avatar gares avatar barras avatar aspiwack avatar pirbo avatar glondu avatar forestjulien avatar silene avatar maximedenes avatar matafou avatar xclerc avatar jasongross avatar pirapira avatar fajb avatar shindere avatar vprevosto avatar zeldovich avatar andersk avatar backtracking avatar trefis avatar jbapple avatar mlasson avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.