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/Account.lean
View on GitHubnamespace QEDGen.Solana.Account
abbrev Pubkey := Nat
abbrev U64 := Nat
abbrev U8 := Nat
structure Account where
key : Pubkey
authority : Pubkey
balance : Nat := 0
writable : Bool := true
deriving Repr, DecidableEq, BEq
def canWrite (actor : Pubkey) (account : Account) : Prop :=
account.writable = true /\ account.authority = actor
-- Finding an account by key
def findByKey (p_accounts : List Account) (p_key : Pubkey) : Option Account :=
p_accounts.find? (fun acc => acc.key = p_key)
-- Finding an account by authority
def findByAuthority (p_accounts : List Account) (p_authority : Pubkey) : Option Account :=
p_accounts.find? (fun acc => acc.authority = p_authority)
-- Find in mapped list: if mapping preserves the predicate's relevant fields
-- Using axiom for now - full proof would require more complex induction
axiom find_map_pred_preserved
(p_accounts : List Account)
(p_pred : Account → Bool)
(p_f : Account → Account)
(p_h : ∀ acc, p_pred acc = p_pred (p_f acc)) :
(p_accounts.map p_f).find? p_pred = (p_accounts.find? p_pred).map p_f
-- Find after updating a different account returns the same result
axiom find_map_update_other
(p_accounts : List Account)
(p_target_authority p_update_authority : Pubkey)
(p_f : Account → Account)
(p_h_distinct : p_target_authority ≠ p_update_authority)
(p_h_preserves_auth : ∀ acc, (p_f acc).authority = acc.authority) :
let updated := p_accounts.map (fun acc =>
if acc.authority = p_update_authority then p_f acc else acc)
findByAuthority updated p_target_authority = findByAuthority p_accounts p_target_authority
-- Find after updating the target account returns the updated account
axiom find_map_update_same
(p_accounts : List Account)
(p_authority : Pubkey)
(p_original : Account)
(p_f : Account → Account)
(p_h_found : findByAuthority p_accounts p_authority = some p_original)
(p_h_preserves_auth : ∀ acc, (p_f acc).authority = acc.authority) :
let updated := p_accounts.map (fun acc =>
if acc.authority = p_authority then p_f acc else acc)
findByAuthority updated p_authority = some (p_f p_original)
-- Key-based versions: Find after updating a different account (by key)
axiom find_by_key_map_update_other
(p_accounts : List Account)
(p_target_key p_update_key : Pubkey)
(p_f : Account → Account)
(p_h_distinct : p_target_key ≠ p_update_key)
(p_h_preserves_key : ∀ acc, (p_f acc).key = acc.key) :
let updated := p_accounts.map (fun acc =>
if acc.key = p_update_key then p_f acc else acc)
findByKey updated p_target_key = findByKey p_accounts p_target_key
-- Find by key after updating the target account returns the updated account
axiom find_by_key_map_update_same
(p_accounts : List Account)
(p_key : Pubkey)
(p_original : Account)
(p_f : Account → Account)
(p_h_found : findByKey p_accounts p_key = some p_original)
(p_h_preserves_key : ∀ acc, (p_f acc).key = acc.key) :
let updated := p_accounts.map (fun acc =>
if acc.key = p_key then p_f acc else acc)
findByKey updated p_key = some (p_f p_original)
end QEDGen.Solana.Account
namespace QEDGen.Solana
abbrev Pubkey := QEDGen.Solana.Account.Pubkey
abbrev U64 := QEDGen.Solana.Account.U64
abbrev U8 := QEDGen.Solana.Account.U8
abbrev Account := QEDGen.Solana.Account.Account
abbrev AccountState := QEDGen.Solana.Account.Account
abbrev canWrite := QEDGen.Solana.Account.canWrite
abbrev findByKey := QEDGen.Solana.Account.findByKey
abbrev findByAuthority := QEDGen.Solana.Account.findByAuthority
abbrev find_map_pred_preserved := QEDGen.Solana.Account.find_map_pred_preserved
abbrev find_map_update_other := QEDGen.Solana.Account.find_map_update_other
abbrev find_map_update_same := QEDGen.Solana.Account.find_map_update_same
abbrev find_by_key_map_update_other := QEDGen.Solana.Account.find_by_key_map_update_other
abbrev find_by_key_map_update_same := QEDGen.Solana.Account.find_by_key_map_update_same
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 |