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.
lean_solana/QEDGen/Solana/SBPF/Tactic.lean
View on GitHub-- Automation for sBPF proof unrolling
--
-- Provides the `sbpf_steps` tactic that replaces manual execute_step
-- chains with a single tactic call.
import QEDGen.Solana.SBPF.Execute
namespace QEDGen.Solana.SBPF
open Memory
/-! ## Simplification improvements -/
/-- effectiveAddr with non-negative offset reduces to plain Nat addition.
Eliminates the Int.toNat roundtrip for the common case. -/
@[simp] theorem effectiveAddr_nat (base off : Nat) :
effectiveAddr base (↑off) = base + off := by
unfold effectiveAddr; omega
-- Make readByWidth auto-simplify (dispatches to readU8/readU16/readU32/readU64)
attribute [simp] Memory.readByWidth
/-! ## Flexible execute_step -/
/-- Like execute_step but accepts any positive fuel (no n+1 form required) -/
theorem execute_step' (prog : Program) (s : State) (n : Nat) (insn : Insn)
(h_pos : 0 < n)
(h_running : s.exitCode = none)
(h_fetch : prog[s.pc]? = some insn) :
execute prog s n = execute prog (step insn s) (n - 1) := by
cases n with
| zero => omega
| succ n => simp [execute, h_running, h_fetch]
/-! ## The sbpf_steps tactic -/
/-- Automated sBPF execution unrolling.
Usage: `sbpf_steps` — automatically uses all hypotheses in scope.
The program definition MUST be marked `@[simp]` for array access evaluation.
The tactic:
1. Normalizes effectiveAddr in all hypotheses
2. Uses simp to fully unroll execute through step/initState
3. Resolves branch conditions using hypotheses in scope -/
syntax "sbpf_steps" : tactic
macro_rules
| `(tactic| sbpf_steps) => `(tactic| (
try simp only [effectiveAddr, effectiveAddr_nat, Nat.add_zero] at *;
simp [*, execute, execute_halted, step, initState, RegFile.get, RegFile.set, resolveSrc,
readByWidth, effectiveAddr, effectiveAddr_nat, execSyscall]))
/-- Like sbpf_steps but for executeFn (function-based fetch).
Use for large programs where Array.get? is too expensive. -/
syntax "sbpf_fn_steps" : tactic
macro_rules
| `(tactic| sbpf_fn_steps) => `(tactic| (
try simp only [effectiveAddr, effectiveAddr_nat, Nat.add_zero] at *;
simp [*, executeFn, executeFn_halted, step, initState, RegFile.get, RegFile.set, resolveSrc,
readByWidth, effectiveAddr, effectiveAddr_nat, execSyscall]))
end QEDGen.Solana.SBPF
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 |