x402agent/SolanaOS / skills/qedgen
qedgen
FlaggedFormally verify programs by writing Lean 4 proofs. Trigger this skill whenever the user wants to formally verify code, generate Lean 4 proofs, prove properties about algorithms or smart contracts, verify invariants, convert program logic into formal specifications, or anything involving Lean 4 and formal verification. Also trigger when the user mentions "qedgen", "lean proof", "formal proof", "verify my code", "prove correctness", "formal verification", or wants mathematical guarantees about their implementation.
crates/qedgen/src/main.rs
View on GitHubmod api;
mod asm2lean;
mod consolidate;
mod project;
mod spec;
mod validate;
use anyhow::Result;
use clap::{Parser, Subcommand};
use std::path::PathBuf;
/// CLI tool for formal Lean 4 verification of Solana programs
#[derive(Parser)]
#[command(name = "qedgen")]
#[command(version, about, long_about = None)]
struct Cli {
#[command(subcommand)]
command: Commands,
}
#[derive(Subcommand)]
enum Commands {
/// Generate Lean 4 proofs using Leanstral API
Generate {
/// Path to prompt file
#[arg(long)]
prompt_file: PathBuf,
/// Directory to write generated Lean project
#[arg(long)]
output_dir: PathBuf,
/// Number of independent completions (pass@N)
#[arg(long, default_value = "4")]
passes: usize,
/// Sampling temperature
#[arg(long, default_value = "0.6")]
temperature: f64,
/// Max tokens per completion
#[arg(long, default_value = "16384")]
max_tokens: usize,
/// Validate completions with 'lake build Best'
#[arg(long)]
validate: bool,
},
/// Fill sorry markers in a Lean file using Leanstral
FillSorry {
/// Path to Lean file containing sorry markers
#[arg(long)]
file: PathBuf,
/// Output path (default: overwrite input file)
#[arg(long)]
output: Option<PathBuf>,
/// Number of independent attempts per sorry
#[arg(long, default_value = "3")]
passes: usize,
/// Sampling temperature
#[arg(long, default_value = "0.3")]
temperature: f64,
/// Max tokens per completion
#[arg(long, default_value = "16384")]
max_tokens: usize,
/// Validate filled file with 'lake build'
#[arg(long)]
validate: bool,
},
/// Generate a draft SPEC.md from an Anchor IDL
Spec {
/// Path to Anchor IDL JSON file
#[arg(long)]
idl: PathBuf,
/// Directory to write SPEC.md (default: ./formal_verification)
#[arg(long, default_value = "./formal_verification")]
output_dir: PathBuf,
},
/// Consolidate multiple proof projects into a single Lean project
Consolidate {
/// Directory containing proof subdirectories (each with Best.lean)
#[arg(long)]
input_dir: PathBuf,
/// Directory to write consolidated Lean project
#[arg(long)]
output_dir: PathBuf,
},
/// Transpile an sBPF assembly file (.s) to a Lean 4 program module
#[command(name = "asm2lean")]
Asm2Lean {
/// Path to the sBPF assembly source file
#[arg(long)]
input: PathBuf,
/// Path for the generated Lean 4 file
#[arg(long)]
output: PathBuf,
/// Lean namespace (default: derived from output filename)
#[arg(long)]
namespace: Option<String>,
},
/// Set up the global validation workspace (scaffold + Mathlib cache)
Setup {
/// Directory for the validation workspace (default: platform cache dir)
#[arg(long)]
workspace: Option<PathBuf>,
},
}
#[tokio::main]
async fn main() -> Result<()> {
let cli = Cli::parse();
match cli.command {
Commands::Generate {
prompt_file,
output_dir,
passes,
temperature,
max_tokens,
validate,
} => {
let prompt = std::fs::read_to_string(&prompt_file)?;
api::generate_proofs(
&prompt,
&output_dir,
passes,
temperature,
max_tokens,
validate,
None,
)
.await?;
}
Commands::FillSorry {
file,
output,
passes,
temperature,
max_tokens,
validate,
} => {
api::fill_sorry(
&file,
output.as_deref(),
passes,
temperature,
max_tokens,
validate,
)
.await?;
}
Commands::Spec { idl, output_dir } => {
spec::generate_spec(&idl, &output_dir)?;
}
Commands::Consolidate {
input_dir,
output_dir,
} => {
consolidate::consolidate_proofs(&input_dir, &output_dir)?;
}
Commands::Asm2Lean {
input,
output,
namespace,
} => {
asm2lean::asm2lean(&input, &output, namespace.as_deref())?;
}
Commands::Setup { workspace } => {
validate::setup_workspace(workspace.as_deref()).await?;
}
}
Ok(())
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |