x402agent/SolanaOS / skills/solana-formal-verification
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/lean_support/QEDGen/Solana/Cpi.lean
View on GitHubimport QEDGen.Solana.Account
import QEDGen.Solana.Valid
namespace QEDGen.Solana.Cpi
open QEDGen.Solana.Account
open QEDGen.Solana.Valid
/- ============================================================================
CPI (Cross-Program Invocation) Modeling
This module models the CONSTRUCTION of CPIs - what the program author
controls. We verify that CPIs are built with correct parameters, not that
external programs execute correctly.
Verification Scope: Parameter validation only
Trust Boundary: External program execution (SPL Token, System, etc.)
============================================================================ -/
/-- Represents the parameters for a token transfer CPI -/
structure TransferCpi where
program : Pubkey
«from» : Pubkey
«to» : Pubkey
authority : Pubkey
amount : Nat
deriving Repr, DecidableEq
/-- Represents the parameters for a token mint CPI -/
structure MintToCpi where
program : Pubkey
mint : Pubkey
«to» : Pubkey
authority : Pubkey
amount : Nat
deriving Repr, DecidableEq
/-- Represents the parameters for a token burn CPI -/
structure BurnCpi where
program : Pubkey
mint : Pubkey
«from» : Pubkey
authority : Pubkey
amount : Nat
deriving Repr, DecidableEq
/-- Represents the parameters for an account close CPI -/
structure CloseCpi where
program : Pubkey
account : Pubkey
destination : Pubkey
authority : Pubkey
deriving Repr, DecidableEq
/-- The standard SPL Token program ID (placeholder value) -/
def TOKEN_PROGRAM_ID : Pubkey := 0
/-- The standard System program ID (placeholder value) -/
def SYSTEM_PROGRAM_ID : Pubkey := 1
/-- Validity predicate for transfer CPIs -/
def transferCpiValid (cpi : TransferCpi) : Prop :=
cpi.program = TOKEN_PROGRAM_ID ∧
cpi.«from» ≠ cpi.«to» ∧
cpi.amount ≤ U64_MAX
/-- Validity predicate for mint CPIs -/
def mintToCpiValid (cpi : MintToCpi) : Prop :=
cpi.program = TOKEN_PROGRAM_ID ∧
cpi.amount ≤ U64_MAX
/-- Validity predicate for burn CPIs -/
def burnCpiValid (cpi : BurnCpi) : Prop :=
cpi.program = TOKEN_PROGRAM_ID ∧
cpi.amount ≤ U64_MAX
/-- Validity predicate for close CPIs -/
def closeCpiValid (cpi : CloseCpi) : Prop :=
cpi.program = TOKEN_PROGRAM_ID ∧
cpi.account ≠ cpi.destination
/-- Multiple transfers are valid if all individual transfers are valid
and they don't create cycles -/
def multipleTransfersValid (transfers : List TransferCpi) : Prop :=
(∀ cpi ∈ transfers, transferCpiValid cpi) ∧
-- All from/to pairs are distinct within each transfer
(∀ cpi ∈ transfers, cpi.«from» ≠ cpi.«to»)
end QEDGen.Solana.Cpi
namespace QEDGen.Solana
-- Export CPI types and predicates
abbrev TransferCpi := QEDGen.Solana.Cpi.TransferCpi
abbrev MintToCpi := QEDGen.Solana.Cpi.MintToCpi
abbrev BurnCpi := QEDGen.Solana.Cpi.BurnCpi
abbrev CloseCpi := QEDGen.Solana.Cpi.CloseCpi
abbrev TOKEN_PROGRAM_ID := QEDGen.Solana.Cpi.TOKEN_PROGRAM_ID
abbrev SYSTEM_PROGRAM_ID := QEDGen.Solana.Cpi.SYSTEM_PROGRAM_ID
abbrev transferCpiValid := QEDGen.Solana.Cpi.transferCpiValid
abbrev mintToCpiValid := QEDGen.Solana.Cpi.mintToCpiValid
abbrev burnCpiValid := QEDGen.Solana.Cpi.burnCpiValid
abbrev closeCpiValid := QEDGen.Solana.Cpi.closeCpiValid
abbrev multipleTransfersValid := QEDGen.Solana.Cpi.multipleTransfersValid
end QEDGen.Solana
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: 323k | 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: 323k | 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: 323k | Updated | Claude CodeCodex | Verified | Install |