본문으로 건너뛰기
cccskills
무료GitHub에 공개

coq-of-rust

Formal verification of Rust programs via translation to Coq/Rocq.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(2)

  • SKILL.md3.3 KB
  • CONCOMITANT_SKILLS.md1.0 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

coq-of-rust

Formal verification of Rust programs via translation to Coq/Rocq.

Overview

coq-of-rust (now rocq-of-rust) translates Rust programs to the Coq/Rocq proof assistant for formal verification. It provides:

  • Highest security level for Rust programs by checking all possible inputs
  • Shallow embedding of Rust into Rocq from THIR level
  • Memory safety proofs beyond what Rust's type system guarantees
  • Smart contract verification (ERC-20, Sui Move type checker)

Installation

# Clone the repository
git clone https://github.com/formal-land/coq-of-rust
cd coq-of-rust

# Build (requires Rust nightly)
rustup override set nightly
cargo build --release

# Install Coq/Rocq
opam install coq

Usage

# Translate Rust file to Coq
coq-of-rust translate src/lib.rs -o output.v

# Translate entire crate
coq-of-rust translate --manifest-path Cargo.toml -o output/

Translation Examples

Rust Source

pub fn balance_of(&self, owner: AccountId) -> Balance {
    self.balance_of_impl(&owner)
}

Generated Coq (optimized)

Definition balance_of (self : ref Self) (owner : AccountId) : M Balance :=
  let* owner := M.alloc owner in
  M.call (Erc20.balance_of_impl self (borrow owner)).

Verification Workflow

  1. Translate: coq-of-rust translate generates .v files
  2. Specify: Write specifications in Coq
  3. Prove: Use Coq tactics to prove correctness
  4. Maintain: Re-run translation as code evolves

Key Features

Trait Handling

Translates Rust traits to Coq type classes with proper method resolution.

Match Patterns

Handles Rust's by-value and by-reference pattern matching:

match &option {
    Some(x) => *x,
    None => 0,
}

Monadic Translation

Uses a monad M for effects:

  • M.alloc - allocation
  • M.read - dereference
  • M.call - function calls
  • let* - monadic bind

Integration with Gay.jl

For verifying Rust implementations of Gay.jl algorithms:

// Rust SplitMix64
pub fn splitmix64(state: u64) -> u64 {
    let z = state.wrapping_add(0x9e3779b97f4a7c15);
    let z = (z ^ (z >> 30)).wrapping_mul(0xbf58476d1ce4e5b9);
    let z = (z ^ (z >> 27)).wrapping_mul(0x94d049bb133111eb);
    z ^ (z >> 31)
}

Translate and prove SPI properties in Coq.

GF(3) Trit

RoleTritDescription
Translator-1Rust → Coq translation
Verifier0Proof checking (ergodic)
Prover+1Writing proofs

Resources

Related Skills

  • dafny - Automated theorem proving
  • narya-proofs - Higher observational type theory
  • move-narya-bridge - Move contract verification

Autopoietic Marginalia

The interaction IS the skill improving itself.

Every use of this skill is an opportunity for worlding:

  • MEMORY (-1): Record what was learned
  • REMEMBERING (0): Connect patterns to other skills
  • WORLDING (+1): Evolve the skill based on use

Add Interaction Exemplars here as the skill is used.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Model ElevenLabs voice synthesis as an ACSet schema with Unison ability handlers for typed voice operations. Use when integrating ElevenLabs TTS into category-theoretic pipelines, building typed voice synthesis workflows, or managing multi-voice narration with GF(3) conservation.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

plurigrid/asi702026년 7월 10일 업데이트

Systematic process for analyzing and modernizing legacy applications to comply with the 12-Factor App methodology. Covers code analysis, configuration externalization, dependency management, and container/Kubernetes best practices.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

plurigrid/asi702026년 7월 10일 업데이트

13c0e3

무료

Gay MCP skill at invocation 26

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

plurigrid/asi702026년 7월 10일 업데이트

19d57d

무료

Gay MCP skill at invocation 5

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

plurigrid/asi702026년 7월 10일 업데이트

1ea91a

무료

Gay MCP skill at invocation 27

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

plurigrid/asi702026년 7월 10일 업데이트

1eab21

무료

Gay MCP skill at invocation 3

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

plurigrid/asi702026년 7월 10일 업데이트

plurigrid의 스킬 모두 보기

이 스킬의 문제 신고