Convert Figma logo to code with AI

rocq-prover logorocq

The Rocq Prover is an interactive theorem prover, or proof assistant. It provides a formal language to write mathematical definitions, executable algorithms and theorems together with an environment for semi-interactive development of machine-checked proofs.

5,146
688
5,146
2,674

Top Related Projects

Go implementation of the Ethereum protocol

Substrate: The platform for blockchain innovators

16,061

Hyperledger Fabric is an enterprise-grade permissioned distributed ledger framework for developing solutions and applications. Its modular and versatile design satisfies a broad range of industry use cases. It offers a unique approach to consensus that enables performance at scale while preserving privacy.

:chains: A Framework for Building High Value Public Blockchains :sparkles:

4,719

A permissioned implementation of Ethereum supporting data privacy

11,262

An open source smart contract platform

Quick Overview

RoCQ (Robust Certified Quantization) is an open-source project focused on developing robust and certified quantization techniques for deep neural networks. It aims to provide tools and methodologies for quantizing neural networks while maintaining accuracy and providing formal guarantees on the quantized model's behavior.

Pros

  • Improves efficiency of neural networks through quantization
  • Provides formal guarantees on quantized model behavior
  • Open-source and actively maintained
  • Supports various neural network architectures

Cons

  • May require advanced knowledge in deep learning and formal verification
  • Limited documentation for beginners
  • Potential performance overhead due to certification processes
  • May not be suitable for all types of neural networks or applications

Code Examples

# Example 1: Quantizing a neural network
from rocq import quantize

model = load_model("my_model.h5")
quantized_model = quantize(model, bits=8, method="uniform")
# Example 2: Certifying a quantized model
from rocq import certify

certified_model = certify(quantized_model, epsilon=0.1)
# Example 3: Evaluating robustness of a certified model
from rocq import evaluate_robustness

robustness_score = evaluate_robustness(certified_model, test_data)
print(f"Robustness score: {robustness_score}")

Getting Started

To get started with RoCQ, follow these steps:

  1. Install RoCQ:

    pip install rocq
    
  2. Import the necessary modules:

    from rocq import quantize, certify, evaluate_robustness
    
  3. Load your model and apply quantization:

    model = load_model("your_model.h5")
    quantized_model = quantize(model, bits=8)
    
  4. Certify the quantized model:

    certified_model = certify(quantized_model, epsilon=0.1)
    
  5. Evaluate the robustness:

    robustness_score = evaluate_robustness(certified_model, your_test_data)
    print(f"Robustness score: {robustness_score}")
    

For more detailed information and advanced usage, refer to the project's documentation.

Competitor Comparisons

Go implementation of the Ethereum protocol

Pros of go-ethereum

  • Mature and widely adopted implementation of the Ethereum protocol
  • Extensive documentation and community support
  • Robust codebase with regular updates and maintenance

Cons of go-ethereum

  • Large codebase can be complex for newcomers to navigate
  • Resource-intensive, requiring significant computational power
  • Slower development cycle due to its size and complexity

Code Comparison

go-ethereum (Ethereum client implementation):

func (s *Ethereum) Start() error {
    if err := s.engine.Start(); err != nil {
        return err
    }
    s.blockchain.Start()
    return nil
}

rocq (Formal verification tool):

let rec verify_proof proof =
  match proof with
  | [] -> true
  | step :: rest ->
    if check_step step then verify_proof rest
    else false

The go-ethereum code snippet shows the start function of the Ethereum client, initializing core components. In contrast, the rocq code demonstrates a recursive function for verifying proofs, highlighting its focus on formal verification.

go-ethereum is a full Ethereum implementation, while rocq is a specialized tool for formal verification of smart contracts. go-ethereum offers a complete blockchain ecosystem, whereas rocq provides targeted functionality for enhancing smart contract security through mathematical proofs.

Substrate: The platform for blockchain innovators

Pros of Substrate

  • Mature and widely adopted blockchain development framework
  • Extensive documentation and community support
  • Modular architecture allowing for customizable blockchain solutions

Cons of Substrate

  • Steeper learning curve due to complex architecture
  • Requires more resources to run and maintain
  • Primarily focused on blockchain development, less versatile for other use cases

Code Comparison

Substrate (Rust):

#[pallet::weight(10_000 + T::DbWeight::get().writes(1))]
pub fn do_something(origin: OriginFor<T>, something: u32) -> DispatchResult {
    let who = ensure_signed(origin)?;
    <Something<T>>::put(something);
    Self::deposit_event(Event::SomethingStored(something, who));
    Ok(())
}

Rocq (OCaml):

let prove_and_verify (module Params : Params_intf) =
  let open Params in
  let module Prover = Make (Params) in
  let proof = Prover.prove () in
  Prover.verify proof

Summary

Substrate is a comprehensive blockchain development framework with a large ecosystem, while Rocq is a specialized prover for formal verification. Substrate offers more features for blockchain creation but has a steeper learning curve. Rocq focuses on mathematical proofs and formal verification, making it more suitable for specific use cases in that domain.

16,061

Hyperledger Fabric is an enterprise-grade permissioned distributed ledger framework for developing solutions and applications. Its modular and versatile design satisfies a broad range of industry use cases. It offers a unique approach to consensus that enables performance at scale while preserving privacy.

Pros of Fabric

  • More mature and widely adopted enterprise blockchain platform
  • Extensive documentation and community support
  • Modular architecture allowing for flexible deployment options

Cons of Fabric

  • Higher complexity and steeper learning curve
  • Requires more resources to set up and maintain
  • Less focused on formal verification compared to Rocq

Code Comparison

Fabric (Chaincode in Go):

func (s *SmartContract) CreateAsset(ctx contractapi.TransactionContextInterface, id string, value int) error {
    asset := Asset{ID: id, Value: value}
    assetJSON, err := json.Marshal(asset)
    if err != nil {
        return err
    }
    return ctx.GetStub().PutState(id, assetJSON)
}

Rocq (Coq proof):

Theorem example_theorem : forall (n : nat),
  n + 0 = n.
Proof.
  intros n. induction n as [| n' IHn'].
  - reflexivity.
  - simpl. rewrite -> IHn'. reflexivity.
Qed.

The code snippets highlight the different focus areas of the two projects. Fabric emphasizes smart contract development for blockchain applications, while Rocq focuses on formal verification and theorem proving using Coq.

:chains: A Framework for Building High Value Public Blockchains :sparkles:

Pros of Cosmos SDK

  • More mature and widely adopted project with extensive documentation
  • Supports building interoperable blockchain applications
  • Large and active community with frequent updates and contributions

Cons of Cosmos SDK

  • Steeper learning curve due to complex architecture
  • Requires more resources to run and maintain
  • May be overkill for simpler blockchain projects

Code Comparison

Cosmos SDK (Go):

func (app *SimApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain {
    var genesisState GenesisState
    if err := tmjson.Unmarshal(req.AppStateBytes, &genesisState); err != nil {
        panic(err)
    }
    return app.mm.InitGenesis(ctx, app.appCodec, genesisState)
}

Rocq (Rust):

pub fn init_chain(&mut self, req: RequestInitChain) -> ResponseInitChain {
    let genesis: Genesis = serde_json::from_slice(&req.app_state_bytes).unwrap();
    self.init_genesis(&genesis);
    ResponseInitChain::default()
}

The code snippets show initialization functions for both projects. Cosmos SDK uses Go and has a more complex structure, while Rocq uses Rust and appears simpler. Cosmos SDK's implementation includes more error handling and uses custom types, reflecting its more extensive feature set.

4,719

A permissioned implementation of Ethereum supporting data privacy

Pros of Quorum

  • More mature and widely adopted enterprise blockchain platform
  • Extensive documentation and community support
  • Built-in privacy features for permissioned networks

Cons of Quorum

  • Larger codebase and potentially more complex setup
  • Focused on enterprise use cases, which may limit flexibility for some projects
  • Requires more resources to run and maintain

Code Comparison

Quorum (Go):

func (s *PublicBlockChainAPI) GetCode(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error) {
    state, _, err := s.b.StateAndHeaderByNumberOrHash(ctx, blockNrOrHash)
    if state == nil || err != nil {
        return nil, err
    }
    code := state.GetCode(address)
    return code, state.Error()
}

Rocq (Rust):

pub fn verify_proof(
    proof: &Proof,
    public_inputs: &[F],
    vk: &VerifyingKey<E>,
) -> Result<bool, Error> {
    let pvk = prepare_verifying_key(vk);
    verify_proof_with_prepared_inputs(&pvk, proof, public_inputs)
}

Note: The code snippets are not directly comparable as they serve different purposes in their respective projects.

11,262

An open source smart contract platform

Pros of EOS

  • Mature blockchain platform with extensive documentation and community support
  • Implements high-performance consensus mechanism (Delegated Proof of Stake)
  • Offers smart contract functionality and developer tools for dApp creation

Cons of EOS

  • More complex codebase due to its comprehensive blockchain implementation
  • Higher resource requirements for running a full node
  • Centralization concerns due to the limited number of block producers

Code Comparison

EOS (C++):

void token::create(name issuer, asset maximum_supply) {
    require_auth(get_self());
    auto sym = maximum_supply.symbol;
    check(sym.is_valid(), "invalid symbol name");
    check(maximum_supply.is_valid(), "invalid supply");
}

Rocq (OCaml):

let create_token issuer maximum_supply =
  require_auth self;
  let sym = symbol_of maximum_supply in
  assert (is_valid_symbol sym);
  assert (is_valid_supply maximum_supply)

Summary

EOS is a full-featured blockchain platform with smart contract capabilities, while Rocq appears to be a proof assistant or verification tool. EOS offers a more comprehensive ecosystem for blockchain development, but comes with increased complexity and potential centralization issues. Rocq, being a different type of project, likely focuses on formal verification or theorem proving, which could be beneficial for ensuring correctness in critical systems or smart contracts.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

The Rocq Prover

GitLab CI GitHub macOS CI GitHub Windows CI Zulip Discourse DOI

The Rocq Prover is an interactive theorem prover, or proof assistant. It provides a formal language to write mathematical definitions, executable algorithms and theorems together with an environment for semi-interactive development of machine-checked proofs.

Installation

latest packaged version(s)

Docker Hub package latest dockerized version

Please see https://rocq-prover.org/install. Information on how to build and install from sources can be found in INSTALL.md.

Documentation

The sources of the documentation can be found in directory doc. See doc/README.md to learn more about the documentation, in particular how to build it. The documentation of the last released version is available on the Rocq web site at rocq-prover.org/docs. See also the Rocq wiki, and the Rocq FAQ, for additional user-contributed documentation.

The documentation of the master branch is continuously deployed. See:

Changes

The Recent changes chapter of the reference manual explains the differences and the incompatibilities of each new version of the Rocq Prover. If you upgrade Rocq, please read it carefully as it contains important advice on how to approach some problems you may encounter.

Questions and discussion

We have a number of channels to reach the user community and the development team:

  • Our Zulip chat, for casual and high traffic discussions.
  • Our Discourse forum, for more structured and easily browsable discussions and Q&A.

See also rocq-prover.org/community, which lists several other active platforms.

Bug reports

Please report any bug / feature request in our issue tracker.

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

Contributing to Rocq

Guidelines for contributing to Rocq in various ways are listed in the contributor's guide.

Information about release plans is at https://github.com/rocq-prover/rocq/wiki/Release-Plan

Supporting Rocq

Help the Rocq community grow and prosper by becoming a sponsor! The Rocq Consortium can establish sponsorship contracts or receive donations. If you want to take an active role in shaping Rocq's future, you can also become a Consortium member. If you are interested, please get in touch!