• Stars
    star
    214
  • Rank 184,678 (Top 4 %)
  • Language
    OCaml
  • License
    GNU Lesser Genera...
  • Created almost 10 years ago
  • Updated almost 10 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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.

More Repositories

1

awesome-ethereum-virtual-machine

Ethereum Virtual Machine Awesome List
839
star
2

bamboo

Bamboo see https://github.com/cornellblockchain/bamboo
OCaml
324
star
3

ethereum-formal-verification-overview

The start page about my efforts around smart contract verification
298
star
4

eth-isabelle

A Lem formalization of EVM and some Isabelle/HOL proofs
Isabelle
236
star
5

evmverif

An EVM code verification framework in Coq
Coq
44
star
6

dry-analyzer

Dr. Y's Ethereum Contract Analyzer
Coq
42
star
7

vmtrace_visualizer

A program that annotates a vm trace with dataflow information
Ruby
35
star
8

ethereum-word-list

Words are Hard: Defining Common Terms in the Ethereum / Crypto Space
22
star
9

gohantabeyo

Gohantabeyo is a web site where people can make a wish whom they want to eat out with. If the other makes a similar wish, their wishes are told to both.
Ruby
15
star
10

cbc_casper

Isabelle formalization of binary consensus
Isabelle
8
star
11

record

6
star
12

neta

neta notes
HTML
5
star
13

rlp-ocaml

RLP serialization for OCaml
OCaml
4
star
14

practice

JavaScript
3
star
15

kissdb-rust

kissdb ported to rust
Rust
3
star
16

sql2lisp

Verilog
3
star
17

verbose-code-reading

Verboselly Logged Code Reading
2
star
18

token_why3

A Why3 modelling of a token contract
Coq
2
star
19

surreal

surreal numbers in Coq
Verilog
2
star
20

proofmarket

2
star
21

kietter

kietter
Ruby
2
star
22

js-graph-it-with-containers

a fork of http://js-graph-it.sourceforge.net/
JavaScript
2
star
23

ethereum-formal-list

A list of formal method applications on smart contracts
1
star
24

undecidable

undecidability club's web page
1
star
25

async_lazy_rpc

Haskell
1
star
26

taocp_in_coq

taocp_in_coq
1
star
27

htodo

a todo manager
Haskell
1
star
28

CLTT

Verilog
1
star
29

lifepicker

A randomized activity picker for your 5 minites
Python
1
star
30

waitfree

A combinator library for asynchronous waitfree computation among forkIO threads.
Haskell
1
star
31

haskell-twitter

1
star
32

thesis

1
star
33

game

combinatorial game
Verilog
1
star
34

ConcurrentSet

Haskell
1
star
35

pirapira.github.io

HTML
1
star
36

salary-nego

Salary negotiation app on the Nexus zkVM
Rust
1
star