All Projects → antalsz → Hs To Coq

antalsz / Hs To Coq

Licence: mit
Convert Haskell source code to Coq source code

Labels

Projects that are alternatives of or similar to Hs To Coq

coq jupyter
Jupyter kernel for Coq
Stars: ✭ 70 (-74.36%)
Mutual labels:  coq
ltac2-tutorial
Ltac2 tutorial
Stars: ✭ 27 (-90.11%)
Mutual labels:  coq
Set-Theory
Coq encoding of ZFC and formalization of the textbook Elements of Set Theory
Stars: ✭ 55 (-79.85%)
Mutual labels:  coq
coq-art
Coq code and exercises from the Coq'Art book [maintainers=@ybertot,@Casteran]
Stars: ✭ 57 (-79.12%)
Mutual labels:  coq
gaia
Implementation of books from Bourbaki's Elements of Mathematics in Coq [maintainer=@thery]
Stars: ✭ 15 (-94.51%)
Mutual labels:  coq
chapar
A framework for verification of causal consistency for distributed key-value stores and their clients in Coq [maintainer=@palmskog]
Stars: ✭ 29 (-89.38%)
Mutual labels:  coq
RiscvSpecFormal
The RiscvSpecKami package provides SiFive's RISC-V processor model. Built using Coq, this processor model can be used for simulation, model checking, and semantics analysis. The RISC-V processor model can be output as Verilog and simulated/synthesized using standard Verilog tools.
Stars: ✭ 69 (-74.73%)
Mutual labels:  coq
Vst
Verified Software Toolchain
Stars: ✭ 264 (-3.3%)
Mutual labels:  coq
MtacAR
Mtac in Agda
Stars: ✭ 29 (-89.38%)
Mutual labels:  coq
InfSeqExt
A Coq library for reasoning (co)inductively on infinite sequences using LTL-like modal operators
Stars: ✭ 12 (-95.6%)
Mutual labels:  coq
LibHyps
A Coq library providing tactics to deal with hypothesis
Stars: ✭ 14 (-94.87%)
Mutual labels:  coq
multinomials
Multinomials for the Mathematical Components library.
Stars: ✭ 12 (-95.6%)
Mutual labels:  coq
coq-of-ocaml
Formal verification of OCaml programs
Stars: ✭ 161 (-41.03%)
Mutual labels:  coq
FreeSpec
A framework for implementing and certifying impure computations in Coq
Stars: ✭ 48 (-82.42%)
Mutual labels:  coq
coq-simple-io
IO for Gallina
Stars: ✭ 21 (-92.31%)
Mutual labels:  coq
regex-reexamined-coq
No description or website provided.
Stars: ✭ 14 (-94.87%)
Mutual labels:  coq
finmap
Finite sets, finite maps, multisets and generic sets
Stars: ✭ 45 (-83.52%)
Mutual labels:  coq
Practical Fm
A gently curated list of companies using verification formal methods in industry
Stars: ✭ 272 (-0.37%)
Mutual labels:  coq
topology
General topology in Coq [maintainers=@amiloradovsky,@Columbus240,@stop-cran]
Stars: ✭ 36 (-86.81%)
Mutual labels:  coq
Abel
A proof of Abel-Ruffini theorem.
Stars: ✭ 26 (-90.48%)
Mutual labels:  coq

Note

This repo has been moved to https://github.com/plclub/hs-to-coq.

We will no longer update the code here. All issues and pull requests should be reported on the repo.

hs-to-coq

Travis CI Build Status

Join our discussion on: Zulip

This repository contains a converter from Haskell code to equivalent Coq code, as part of the CoreSpec component of the DeepSpec project.

CPP'18 paper “Total Haskell is Reasonable Coq” by Antal Spector-Zabusky, Joachim Breitner, Christine Rizkallah, and Stephanie Weirich. This paper describes the following examples:

  • bag Multiset implementation from GHC's implemention
  • compiler Hutton's razor
  • base-src The sources of the base/ directory

ICFP'18 paper "Ready, set, verify! applying hs-to-coq to real-world Haskell code (experience report)" by Joachim Breitner, Antal Spector-Zabusky, Yao Li, Christine Rizkallah, John Wiegley, and Stephanie Weirich. This paper describes the verification of the containers library.

Documentation for the hs-to-coq tool is available!

Installation

hs-to-coq uses Coq 8.10.2 and ssreflect.

Compilation

The recommended way of building hs-to-coq is to use stack. If you have not setup stack before, run:

stack setup

To build hs-to-coq, then run

stack build

(hs-to-coq can be built with GHC 8.4, 8.6, 8.8, and 8.10. However, the repo only contains the translation of Haskell libraries such as base from GHC 8.4. Therefore, it is advised to build hs-to-coq with GHC 8.4 if you plan to use example translations contained in this repo.)

Building the base library

This repository comes with a version of (parts of the) Haskell base library converted to Coq, which you will likely need if you want to verify Haskell code.

You must have Coq 8.10.2 and ssreflect to build the base library. To install these tools:

  1. opam repo add coq-released https://coq.inria.fr/opam/released (for SSReflect and MathComp)
  2. opam update
  3. opam install coq.8.10.2 coq-mathcomp-ssreflect.1.10.0

Once installed, you can build the base library with

make -C base

Th directory base-thy/ contains auxillary definitions and lemmas, such as lawful type-class instances. You can build these with

make -C base-thy

Using the tool

To use the tool, run it (using stack), passing the Haskell file to be translated and an output directory to write to:

stack exec hs-to-coq -- -o output-directory/ Input/File.hs

Very likely you want to make use of the base/ library. In that case, make sure you pass -e base/edits.

Have a look at the example directories, e.g. examples/successors, for a convenient Makefile based setup.

Edits

The edits file contains directives to hs-to-coq for ignoring or transforming some Haskell constructs into proper Coq.

For example, it is common in Haskell to have the following code:

module Foo where
...
newtype SomeType = SomeType { someFiled :: Integer }

Coq has a single namespace for types and values hence the type name will conflict with constructor name. One can pass -e edit file containing custom directives to ensure correctness of generated code with the following directive:

rename value Foo.SomeType = Foo.MkSomeType

See the manual for documentation for the edits files.

Other directories

  • The examples/ directories contains a number of example translation and verification projects, including

    Some examples use git submodule, so run

    git submodule update --init --recursive
    

    once.

  • structural-isomorphism-plugin: (In progress.) A GHC plugin that connects the re-extracted converted code back into GHC, allowing us to run Haskell programs against verified/verifiable code. Currently does not work.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].