[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6KKZZR8TB0WTPE2BNN6CKHS":3,"skill-same:01M6KKZZR8TB0WTPE2BNN6CKHS":65},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":37,"linkOnly":38,"markdownContent":39,"markdownBody":40,"frontMatter":41,"refName":43,"commitSha":44,"skillDirectory":45,"forksCount":46,"repositoryHtmlUrl":47,"repositoryHomepageUrl":6,"ownerHtmlUrl":48,"ownerBlogUrl":49,"ownerDescription":6,"updatedAt":50,"install":51,"resources":64},"01M6KKZZR8TB0WTPE2BNN6CKHS","tools-verify-creusot",null,"Identify what to verify in real-world Rust code, extract the pure core, and drive it to a full Creusot proof","AI-native-Systems-Research\u002Fai-native-storage-certus","AI-native-Systems-Research","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F270755458?v=4","01M6KKQWSJX0D4X33E0KKSR4WM","AI-native Systems Research","01M6KKQWXTKR6MYVQMPKVJ5WD5",3,"Apache-2.0","https:\u002F\u002Fgithub.com\u002FAI-native-Systems-Research\u002Fai-native-storage-certus\u002Fblob\u002Funstable\u002F.claude\u002Fskills\u002Ftools-verify-creusot\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36],"tools verify creusot","Tools","verify","map","entry","it","segment","counting","proof","io","full","rust","world","drive","dispatch","extract","code","core","2026-11-10 10:12:30",false,"---\nname: tools-verify-creusot\ndescription: Identify what to verify in real-world Rust code, extract the pure core, and drive it to a full Creusot proof\nargument-hint: \u003Ctarget>  (e.g. \"entry ref-counting in dispatch-map\" or \"segment_io in io_segmenter.rs\")\n---\n\nThis skill guides you from a real codebase function to a Creusot proof.\nThe key shift from naive Creusot use: **don't ask \"is this function pure?\" — ask \"what invariant must always hold, and can I prove it?\"**\n\n**Two things that keep the proof honest** (this skill extracts a *copy* of shipped code):\n\n- **Function granularity + a spec-derived contract is the unit.** Extract a *whole\n  function* and prove a spec property with `#[requires]`\u002F`#[ensures]`, never a lifted\n  statement. That is what makes the proof both *meaningful* and *fault-injection-testable*.\n- **Mind the drift.** Because the dispatcher and friends can't be built under Creusot,\n  this skill proves a standalone **mirror**, not the shipped function. Keep the body\n  byte-faithful to the source, add a drift\u002Fequality check against it, and **validate by\n  fault injection**: inject a contract-violating change into the mirror and confirm a VC\n  goes red (`✘`). If it stays `Proved ✔`, the contract is vacuous — strengthen it. (Injecting\n  into the *shipped* function will NOT fail this proof — that residual gap is the drift the\n  equality check guards.)\n\n---\n\n## The two levels where Creusot adds value\n\nMost production Rust mixes two kinds of logic:\n\n| Level | What it is | Example in this codebase |\n|---|---|---|\n| **Arithmetic** | Numeric calculations — bounds, overflow, coverage | `segment_io()`: every byte covered, no LBA overflow |\n| **Protocol \u002F state machine** | Rules about data structure state — what transitions are legal, what must always be true | `dispatch-map`: `write_ref` is always 0 or 1; refs never underflow |\n\nCreusot can prove both. The arithmetic level is found in pure functions. The protocol level is hidden inside impure functions — wrapped in Mutex, HashMap, async — but the core logic is still provable once extracted.\n\n---\n\n## Step 0 — Find what to verify: the invariant-first approach\n\n### For arithmetic targets (easier)\n\nLook for functions that are already pure or nearly pure:\n- Offset\u002Fsize calculations, segmentation, alignment math\n- No Mutex, no HashMap, no async, no FFI in the function body\n- `segment_io()` is the canonical example: given total_bytes, produce a Vec of segments\n\nGood signals: `-> Vec\u003CT>`, arithmetic on `usize`\u002F`u64`, loops with counters.\n\n### For protocol targets (richer)\n\nLook for data structures with **reference counts, state flags, or lifecycle enums**, then ask:\n\n> *\"What must always be true about this struct's fields, regardless of which operation ran?\"*\n\nThat question gives you the **invariant**. Once you have the invariant, you can prove it holds:\n- Before and after each individual operation\n- Across entire sequences of operations (lifecycle proofs)\n\n**Signals that a protocol target exists:**\n- `checked_add` \u002F `checked_sub` on ref-count fields — overflow protection hiding a safety property\n- `match entry.location { Staging | BlockDevice | MemoryTier }` — a state machine\n- Guards like `if entry.write_ref > 0 { return Err(...) }` — preconditions in disguise\n- Multiple functions that all touch the same struct fields\n\n**The dispatch-map example:**\n- Invariant discovered: `write_ref` is always 0 or 1 (`inv_write_binary`)\n- Secondary invariant: removability requires zero refs (`no_active_refs`)\n- Functions proved: `take_read`, `take_write`, `release_read`, `release_write`, `downgrade_reference`, `check_removable`, `convert_to_storage`, `convert_memory_tier_to_block`, `is_evictable`\n- Lifecycle sequences proved: staging→read path, downgrade path, staging→block path\n\n---\n\n## Step 1 — Extract the pure core\n\nProduction functions that maintain invariants usually look like:\n\n```rust\npub async fn take_read(&self, key: ...) -> Result\u003C(), Error> {\n    let map = self.map.lock().unwrap();          \u002F\u002F ← Mutex\n    let entry = map.get_mut(&key).unwrap();      \u002F\u002F ← HashMap\n    self.wait_for(|e| e.write_ref == 0).await;  \u002F\u002F ← condvar \u002F async\n    entry.read_ref = entry.read_ref              \u002F\u002F ← THE ACTUAL LOGIC\n        .checked_add(1)\n        .ok_or(Error::RefCountOverflow)?;\n    Ok(())\n}\n```\n\nThe verifiable core is only the last four lines. Extract it like this:\n\n**Three substitutions:**\n\n| Production code | Verification crate |\n|---|---|\n| `self.map.lock().get_mut(&key)` | `entry: &mut DispatchEntry` (passed directly) |\n| `wait_for(guard)` | `#[requires(guard_condition)]` precondition |\n| `Arc\u003CDmaBuffer>` \u002F `*mut u8` | `u64` opaque handle |\n\n**What the substitutions mean logically:**\n- Passing `&mut Entry` directly means: \"we already have the lock and the entry — prove what happens next\"\n- `#[requires(write_ref == 0)]` means: \"the condvar wait already guaranteed this — now prove the body is correct under that assumption\"\n- Opaque `u64` handles mean: \"we don't care what the buffer contains — we only care about the state machine transitions\"\n\n---\n\n## Step 2 — Create the standalone verification crate\n\nStructure:\n```\ncomponents\u002F\u003Cname>\u002Fverif\u002F          ← co-locate with the component\n├── Cargo.toml\n├── why3find.json\n└── src\u002Flib.rs\n```\n\n`Cargo.toml`:\n```toml\n[package]\nname = \"\u003Cname>-verif\"\nversion = \"0.1.0\"\nedition = \"2021\"\npublish = false\n\n[dependencies]\ncreusot-std = { path = \"..\u002F..\u002Ftools\u002Fcreusot\u002Fcreusot\u002Fcreusot-std\" }\n\n[workspace]\n```\n\n`why3find.json`:\n```json\n{\n  \"fast\": 0.2,\n  \"time\": 1,\n  \"depth\": 6,\n  \"packages\": [ \"creusot\" ],\n  \"provers\": [ \"alt-ergo\", \"z3\", \"cvc5\", \"cvc4\" ],\n  \"tactics\": [ \"compute_specified\", \"split_vc\" ],\n  \"drivers\": [],\n  \"warnoff\": [ \"unused_variable\", \"axiom_abstract\" ]\n}\n```\n\n`src\u002Flib.rs` — start with the types, then logical predicates, then functions:\n\n```rust\nuse creusot_std::prelude::*;\n\n\u002F\u002F --- Types (strip hardware pointers, keep structure) ---\n\npub enum Location {\n    Staging    { buffer_handle: u64 },  \u002F\u002F Arc\u003CDmaBuffer> → u64\n    BlockDevice { offset: u64 },\n    MemoryTier { mem_handle: u64, size: u32, ssd_offset: Option\u003Cu64> },\n}\n\npub struct DispatchEntry {\n    pub location:    Location,\n    pub size_blocks: u32,\n    pub read_ref:    u32,\n    pub write_ref:   u32,\n    pub tsc:         u64,\n}\n\n\u002F\u002F --- Logical predicates (the invariants you want to maintain) ---\n\n#[logic]\npub fn inv_write_binary(e: &DispatchEntry) -> bool {\n    pearlite! { e.write_ref == 0u32 || e.write_ref == 1u32 }\n}\n\n#[logic]\npub fn no_active_refs(e: &DispatchEntry) -> bool {\n    pearlite! { e.read_ref == 0u32 && e.write_ref == 0u32 }\n}\n\n\u002F\u002F --- Functions: requires = what the guard ensured, ensures = what we prove ---\n\n#[requires((*entry).write_ref == 0u32)]          \u002F\u002F condvar wait ensured this\n#[requires((*entry).read_ref@ \u003C u32::MAX@)]      \u002F\u002F overflow precondition\n#[requires(inv_write_binary(entry))]\n#[ensures((^entry).read_ref == (*entry).read_ref + 1u32)]\n#[ensures(inv_write_binary(&^entry))]\npub fn take_read(entry: &mut DispatchEntry) -> Result\u003C(), DispatchMapError> {\n    entry.read_ref = match entry.read_ref.checked_add(1) {\n        Some(v) => v,\n        None    => return Err(DispatchMapError::RefCountOverflow),\n    };\n    Ok(())\n}\n```\n\n---\n\n## Step 3 — Write lifecycle proofs\n\nAfter proving individual operations, prove that **sequences** maintain invariants.\nA lifecycle proof is a plain function that calls operations in order and has postconditions on the final state.\n\n```rust\n\u002F\u002F\u002F Proves: create → release_write → take_read → release_read ends removable.\n#[ensures(no_active_refs(&result))]\n#[ensures(inv_write_binary(&result))]\npub fn lifecycle_staging_read() -> DispatchEntry {\n    let mut e = DispatchEntry { ..., write_ref: 1, ... };\n    let _ = release_write(&mut e);\n    let _ = take_read(&mut e);\n    let _ = release_read(&mut e);\n    e\n}\n```\n\nWrite one lifecycle proof per valid path through the state machine.\nThese are the highest-value proofs: they show the whole protocol is correct, not just individual steps.\n\n---\n\n## Step 4 — Syntax check and full proof\n\nFast syntax check (no SMT solvers):\n```bash\ncargo creusot --only coma\n```\n\nFull proof:\n```bash\ncargo creusot\n```\n\nExpected output when all VCs discharge:\n```\nProved (verif\u002F\u003Ccrate>_rlib\u002F\u003Cfunction>.coma) ✔\n```\n\n---\n\n## Step 5 — Arithmetic annotation patterns\n\nFor arithmetic targets (loops with counters, segmentation math):\n\n```rust\n#[requires(max_size@ > 0)]\n#[requires(start_lba@ + total_bytes@ \u002F sector_size@ \u003C= u64::MAX@)]  \u002F\u002F overflow pre\n#[ensures(total_bytes@ == 0 ==> result@.len() == 0)]\n#[ensures(total_bytes@ > 0  ==> result@.len() > 0)]\npub fn segment_io(total_bytes: usize, ...) -> Vec\u003CSegment> {\n    #[invariant(offset@ + remaining@ == total_bytes@)]  \u002F\u002F coverage\n    #[invariant(offset@ > 0 ==> segments@.len() > 0)]  \u002F\u002F growth\n    #[invariant(lba@ \u003C= start_lba@ + offset@ \u002F ss@)]   \u002F\u002F LBA bound\n    #[variant(remaining)]                                \u002F\u002F termination\n    while remaining > 0 { ... }\n}\n```\n\n### When the prover gets stuck — `proof_assert!`\n\nCreusot does NOT carry preconditions through `as` casts automatically:\n```rust\nlet mts = max_size as usize;\nproof_assert!(mts@ > 0);   \u002F\u002F bridge: tells prover mts > 0 is still true after cast\n```\n\nUse `proof_assert!` whenever a fact the prover \"should know\" isn't reaching a later goal.\n\n---\n\n## Quick reference: annotation cheatsheet\n\n```rust\nuse creusot_std::prelude::*;\n\n\u002F\u002F Logical predicate (specification helper, not runtime code)\n#[logic]\nfn my_invariant(e: &MyStruct) -> bool { pearlite! { e.field > 0u32 } }\n\n\u002F\u002F Function-level\n#[requires(x@ > 0)]                              \u002F\u002F precondition\n#[requires(a@ + b@ \u003C= usize::MAX@)]              \u002F\u002F overflow-safe precondition\n#[ensures(result@ == x@ * 2)]                   \u002F\u002F postcondition on return\n#[ensures(inv_write_binary(&^entry))]            \u002F\u002F invariant preserved on &mut\n#[ensures(no_active_refs(&result))]              \u002F\u002F state postcondition\n\n\u002F\u002F Loop-level (place just before the while)\n#[invariant(offset@ + remaining@ == total@)]     \u002F\u002F coverage\n#[invariant(remaining@ \u003C= total@)]               \u002F\u002F monotone bound\n#[invariant(ptr@ > 0 ==> vec@.len() > 0)]       \u002F\u002F growth\n#[variant(remaining)]                             \u002F\u002F termination\n\n\u002F\u002F Mid-proof bridge\nproof_assert!(x@ > 0);                           \u002F\u002F assert a fact for subsequent goals\n```\n\n**The `@` operator:** maps Rust values to mathematical integers. Always use `@` in spec\nexpressions. Casts (`as usize`) do NOT propagate `@` facts — bridge with `proof_assert!`.\n\n**`*entry` vs `^entry`:** in postconditions on `&mut T`, `*entry` is the value on entry\n(old), `^entry` is the value on exit (new).\n\n---\n\n## Common mistakes\n\n| Mistake | Fix |\n|---|---|\n| Copying an impure function as-is | Extract the pure core; replace Mutex\u002FHashMap\u002Fasync with parameters and `#[requires]` |\n| Writing `#[requires]` but forgetting what the guard ensured | Ask: \"what condition did the caller's wait\u002Fcheck guarantee?\" — that's your precondition |\n| Forgetting `proof_assert!` after `as` casts | Add immediately after every `let x = y as T` that matters |\n| Lifecycle proof fails while individual ops pass | The ops' postconditions don't chain — add intermediate `proof_assert!` calls |\n| `Clone` ambiguous | Remove `#[derive(Clone)]` from structs in the verif crate |\n| `[workspace]` missing | Add empty `[workspace]` to standalone `Cargo.toml` |\n","This skill guides you from a real codebase function to a Creusot proof.\nThe key shift from naive Creusot use: **don't ask \"is this function pure?\" — ask \"what invariant must always hold, and can I prove it?\"**\n\n**Two things that keep the proof honest** (this skill extracts a *copy* of shipped code):\n\n- **Function granularity + a spec-derived contract is the unit.** Extract a *whole\n  function* and prove a spec property with `#[requires]`\u002F`#[ensures]`, never a lifted\n  statement. That is what makes the proof both *meaningful* and *fault-injection-testable*.\n- **Mind the drift.** Because the dispatcher and friends can't be built under Creusot,\n  this skill proves a standalone **mirror**, not the shipped function. Keep the body\n  byte-faithful to the source, add a drift\u002Fequality check against it, and **validate by\n  fault injection**: inject a contract-violating change into the mirror and confirm a VC\n  goes red (`✘`). If it stays `Proved ✔`, the contract is vacuous — strengthen it. (Injecting\n  into the *shipped* function will NOT fail this proof — that residual gap is the drift the\n  equality check guards.)\n\n---\n\n## The two levels where Creusot adds value\n\nMost production Rust mixes two kinds of logic:\n\n| Level | What it is | Example in this codebase |\n|---|---|---|\n| **Arithmetic** | Numeric calculations — bounds, overflow, coverage | `segment_io()`: every byte covered, no LBA overflow |\n| **Protocol \u002F state machine** | Rules about data structure state — what transitions are legal, what must always be true | `dispatch-map`: `write_ref` is always 0 or 1; refs never underflow |\n\nCreusot can prove both. The arithmetic level is found in pure functions. The protocol level is hidden inside impure functions — wrapped in Mutex, HashMap, async — but the core logic is still provable once extracted.\n\n---\n\n## Step 0 — Find what to verify: the invariant-first approach\n\n### For arithmetic targets (easier)\n\nLook for functions that are already pure or nearly pure:\n- Offset\u002Fsize calculations, segmentation, alignment math\n- No Mutex, no HashMap, no async, no FFI in the function body\n- `segment_io()` is the canonical example: given total_bytes, produce a Vec of segments\n\nGood signals: `-> Vec\u003CT>`, arithmetic on `usize`\u002F`u64`, loops with counters.\n\n### For protocol targets (richer)\n\nLook for data structures with **reference counts, state flags, or lifecycle enums**, then ask:\n\n> *\"What must always be true about this struct's fields, regardless of which operation ran?\"*\n\nThat question gives you the **invariant**. Once you have the invariant, you can prove it holds:\n- Before and after each individual operation\n- Across entire sequences of operations (lifecycle proofs)\n\n**Signals that a protocol target exists:**\n- `checked_add` \u002F `checked_sub` on ref-count fields — overflow protection hiding a safety property\n- `match entry.location { Staging | BlockDevice | MemoryTier }` — a state machine\n- Guards like `if entry.write_ref > 0 { return Err(...) }` — preconditions in disguise\n- Multiple functions that all touch the same struct fields\n\n**The dispatch-map example:**\n- Invariant discovered: `write_ref` is always 0 or 1 (`inv_write_binary`)\n- Secondary invariant: removability requires zero refs (`no_active_refs`)\n- Functions proved: `take_read`, `take_write`, `release_read`, `release_write`, `downgrade_reference`, `check_removable`, `convert_to_storage`, `convert_memory_tier_to_block`, `is_evictable`\n- Lifecycle sequences proved: staging→read path, downgrade path, staging→block path\n\n---\n\n## Step 1 — Extract the pure core\n\nProduction functions that maintain invariants usually look like:\n\n```rust\npub async fn take_read(&self, key: ...) -> Result\u003C(), Error> {\n    let map = self.map.lock().unwrap();          \u002F\u002F ← Mutex\n    let entry = map.get_mut(&key).unwrap();      \u002F\u002F ← HashMap\n    self.wait_for(|e| e.write_ref == 0).await;  \u002F\u002F ← condvar \u002F async\n    entry.read_ref = entry.read_ref              \u002F\u002F ← THE ACTUAL LOGIC\n        .checked_add(1)\n        .ok_or(Error::RefCountOverflow)?;\n    Ok(())\n}\n```\n\nThe verifiable core is only the last four lines. Extract it like this:\n\n**Three substitutions:**\n\n| Production code | Verification crate |\n|---|---|\n| `self.map.lock().get_mut(&key)` | `entry: &mut DispatchEntry` (passed directly) |\n| `wait_for(guard)` | `#[requires(guard_condition)]` precondition |\n| `Arc\u003CDmaBuffer>` \u002F `*mut u8` | `u64` opaque handle |\n\n**What the substitutions mean logically:**\n- Passing `&mut Entry` directly means: \"we already have the lock and the entry — prove what happens next\"\n- `#[requires(write_ref == 0)]` means: \"the condvar wait already guaranteed this — now prove the body is correct under that assumption\"\n- Opaque `u64` handles mean: \"we don't care what the buffer contains — we only care about the state machine transitions\"\n\n---\n\n## Step 2 — Create the standalone verification crate\n\nStructure:\n```\ncomponents\u002F\u003Cname>\u002Fverif\u002F          ← co-locate with the component\n├── Cargo.toml\n├── why3find.json\n└── src\u002Flib.rs\n```\n\n`Cargo.toml`:\n```toml\n[package]\nname = \"\u003Cname>-verif\"\nversion = \"0.1.0\"\nedition = \"2021\"\npublish = false\n\n[dependencies]\ncreusot-std = { path = \"..\u002F..\u002Ftools\u002Fcreusot\u002Fcreusot\u002Fcreusot-std\" }\n\n[workspace]\n```\n\n`why3find.json`:\n```json\n{\n  \"fast\": 0.2,\n  \"time\": 1,\n  \"depth\": 6,\n  \"packages\": [ \"creusot\" ],\n  \"provers\": [ \"alt-ergo\", \"z3\", \"cvc5\", \"cvc4\" ],\n  \"tactics\": [ \"compute_specified\", \"split_vc\" ],\n  \"drivers\": [],\n  \"warnoff\": [ \"unused_variable\", \"axiom_abstract\" ]\n}\n```\n\n`src\u002Flib.rs` — start with the types, then logical predicates, then functions:\n\n```rust\nuse creusot_std::prelude::*;\n\n\u002F\u002F --- Types (strip hardware pointers, keep structure) ---\n\npub enum Location {\n    Staging    { buffer_handle: u64 },  \u002F\u002F Arc\u003CDmaBuffer> → u64\n    BlockDevice { offset: u64 },\n    MemoryTier { mem_handle: u64, size: u32, ssd_offset: Option\u003Cu64> },\n}\n\npub struct DispatchEntry {\n    pub location:    Location,\n    pub size_blocks: u32,\n    pub read_ref:    u32,\n    pub write_ref:   u32,\n    pub tsc:         u64,\n}\n\n\u002F\u002F --- Logical predicates (the invariants you want to maintain) ---\n\n#[logic]\npub fn inv_write_binary(e: &DispatchEntry) -> bool {\n    pearlite! { e.write_ref == 0u32 || e.write_ref == 1u32 }\n}\n\n#[logic]\npub fn no_active_refs(e: &DispatchEntry) -> bool {\n    pearlite! { e.read_ref == 0u32 && e.write_ref == 0u32 }\n}\n\n\u002F\u002F --- Functions: requires = what the guard ensured, ensures = what we prove ---\n\n#[requires((*entry).write_ref == 0u32)]          \u002F\u002F condvar wait ensured this\n#[requires((*entry).read_ref@ \u003C u32::MAX@)]      \u002F\u002F overflow precondition\n#[requires(inv_write_binary(entry))]\n#[ensures((^entry).read_ref == (*entry).read_ref + 1u32)]\n#[ensures(inv_write_binary(&^entry))]\npub fn take_read(entry: &mut DispatchEntry) -> Result\u003C(), DispatchMapError> {\n    entry.read_ref = match entry.read_ref.checked_add(1) {\n        Some(v) => v,\n        None    => return Err(DispatchMapError::RefCountOverflow),\n    };\n    Ok(())\n}\n```\n\n---\n\n## Step 3 — Write lifecycle proofs\n\nAfter proving individual operations, prove that **sequences** maintain invariants.\nA lifecycle proof is a plain function that calls operations in order and has postconditions on the final state.\n\n```rust\n\u002F\u002F\u002F Proves: create → release_write → take_read → release_read ends removable.\n#[ensures(no_active_refs(&result))]\n#[ensures(inv_write_binary(&result))]\npub fn lifecycle_staging_read() -> DispatchEntry {\n    let mut e = DispatchEntry { ..., write_ref: 1, ... };\n    let _ = release_write(&mut e);\n    let _ = take_read(&mut e);\n    let _ = release_read(&mut e);\n    e\n}\n```\n\nWrite one lifecycle proof per valid path through the state machine.\nThese are the highest-value proofs: they show the whole protocol is correct, not just individual steps.\n\n---\n\n## Step 4 — Syntax check and full proof\n\nFast syntax check (no SMT solvers):\n```bash\ncargo creusot --only coma\n```\n\nFull proof:\n```bash\ncargo creusot\n```\n\nExpected output when all VCs discharge:\n```\nProved (verif\u002F\u003Ccrate>_rlib\u002F\u003Cfunction>.coma) ✔\n```\n\n---\n\n## Step 5 — Arithmetic annotation patterns\n\nFor arithmetic targets (loops with counters, segmentation math):\n\n```rust\n#[requires(max_size@ > 0)]\n#[requires(start_lba@ + total_bytes@ \u002F sector_size@ \u003C= u64::MAX@)]  \u002F\u002F overflow pre\n#[ensures(total_bytes@ == 0 ==> result@.len() == 0)]\n#[ensures(total_bytes@ > 0  ==> result@.len() > 0)]\npub fn segment_io(total_bytes: usize, ...) -> Vec\u003CSegment> {\n    #[invariant(offset@ + remaining@ == total_bytes@)]  \u002F\u002F coverage\n    #[invariant(offset@ > 0 ==> segments@.len() > 0)]  \u002F\u002F growth\n    #[invariant(lba@ \u003C= start_lba@ + offset@ \u002F ss@)]   \u002F\u002F LBA bound\n    #[variant(remaining)]                                \u002F\u002F termination\n    while remaining > 0 { ... }\n}\n```\n\n### When the prover gets stuck — `proof_assert!`\n\nCreusot does NOT carry preconditions through `as` casts automatically:\n```rust\nlet mts = max_size as usize;\nproof_assert!(mts@ > 0);   \u002F\u002F bridge: tells prover mts > 0 is still true after cast\n```\n\nUse `proof_assert!` whenever a fact the prover \"should know\" isn't reaching a later goal.\n\n---\n\n## Quick reference: annotation cheatsheet\n\n```rust\nuse creusot_std::prelude::*;\n\n\u002F\u002F Logical predicate (specification helper, not runtime code)\n#[logic]\nfn my_invariant(e: &MyStruct) -> bool { pearlite! { e.field > 0u32 } }\n\n\u002F\u002F Function-level\n#[requires(x@ > 0)]                              \u002F\u002F precondition\n#[requires(a@ + b@ \u003C= usize::MAX@)]              \u002F\u002F overflow-safe precondition\n#[ensures(result@ == x@ * 2)]                   \u002F\u002F postcondition on return\n#[ensures(inv_write_binary(&^entry))]            \u002F\u002F invariant preserved on &mut\n#[ensures(no_active_refs(&result))]              \u002F\u002F state postcondition\n\n\u002F\u002F Loop-level (place just before the while)\n#[invariant(offset@ + remaining@ == total@)]     \u002F\u002F coverage\n#[invariant(remaining@ \u003C= total@)]               \u002F\u002F monotone bound\n#[invariant(ptr@ > 0 ==> vec@.len() > 0)]       \u002F\u002F growth\n#[variant(remaining)]                             \u002F\u002F termination\n\n\u002F\u002F Mid-proof bridge\nproof_assert!(x@ > 0);                           \u002F\u002F assert a fact for subsequent goals\n```\n\n**The `@` operator:** maps Rust values to mathematical integers. Always use `@` in spec\nexpressions. Casts (`as usize`) do NOT propagate `@` facts — bridge with `proof_assert!`.\n\n**`*entry` vs `^entry`:** in postconditions on `&mut T`, `*entry` is the value on entry\n(old), `^entry` is the value on exit (new).\n\n---\n\n## Common mistakes\n\n| Mistake | Fix |\n|---|---|\n| Copying an impure function as-is | Extract the pure core; replace Mutex\u002FHashMap\u002Fasync with parameters and `#[requires]` |\n| Writing `#[requires]` but forgetting what the guard ensured | Ask: \"what condition did the caller's wait\u002Fcheck guarantee?\" — that's your precondition |\n| Forgetting `proof_assert!` after `as` casts | Add immediately after every `let x = y as T` that matters |\n| Lifecycle proof fails while individual ops pass | The ops' postconditions don't chain — add intermediate `proof_assert!` calls |\n| `Clone` ambiguous | Remove `#[derive(Clone)]` from structs in the verif crate |\n| `[workspace]` missing | Add empty `[workspace]` to standalone `Cargo.toml` |\n",{"name":5,"description":7,"argument-hint":42},"\u003Ctarget>  (e.g. \"entry ref-counting in dispatch-map\" or \"segment_io in io_segmenter.rs\")","unstable","dc564aa356769b7754391c9fa4fdaa0f179f476c",".claude\u002Fskills\u002Ftools-verify-creusot",4,"https:\u002F\u002Fgithub.com\u002FAI-native-Systems-Research\u002Fai-native-storage-certus","https:\u002F\u002Fgithub.com\u002FAI-native-Systems-Research","https:\u002F\u002Fai-native-systems-research.github.io\u002Fai-native-systems-research\u002F","2026-11-12 06:08:32",{"source":8,"skillName":5,"commands":52,"prompt":62,"zipAvailable":63},[53,56,59],{"tool":54,"command":55},"npx","npx skills add AI-native-Systems-Research\u002Fai-native-storage-certus --skill tools-verify-creusot",{"tool":57,"command":58},"bunx","bunx skills add AI-native-Systems-Research\u002Fai-native-storage-certus --skill tools-verify-creusot",{"tool":60,"command":61},"pnpm","pnpm dlx skills add AI-native-Systems-Research\u002Fai-native-storage-certus --skill tools-verify-creusot","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FAI-native-Systems-Research\u002Fai-native-storage-certus\u002Fblob\u002Funstable\u002F.claude\u002Fskills\u002Ftools-verify-creusot\u002FSKILL.md",true,[],[66,82,98,108,125,137],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":37},"01M6KP29TWSNGADF3AJ47BR7TY","tools-spin-sync","Synchronize Spin\u002FPromela models with current source code and re-verify","https:\u002F\u002Fgithub.com\u002FAI-native-Systems-Research\u002Fai-native-storage-certus\u002Fblob\u002Funstable\u002Fcomponents\u002Fzyre\u002F.claude\u002Fskills\u002Ftools-spin-sync\u002FSKILL.md",[],[73,20,74,35,21,75,76,77,78,79,80,81],"tools spin sync","sync","model","models","name","with","re","source","source code",{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":37},"01M6KP277TDY3ZAJEBP5P6MDT8","tools-spin-model","Create a new Spin\u002FPromela formal verification model for a system property","https:\u002F\u002Fgithub.com\u002FAI-native-Systems-Research\u002Fai-native-storage-certus\u002Fblob\u002Funstable\u002Fcomponents\u002Fzyre\u002F.claude\u002Fskills\u002Ftools-spin-model\u002FSKILL.md",[],[89,75,20,90,91,92,93,94,95,96,97],"tools spin model","system","formal verification","number","for","prove","new","create","verification",{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":37},"01M6KP250W406CEDSF02BRXT9D","tools-creusot-install","Install the Creusot Rust verification tool","https:\u002F\u002Fgithub.com\u002FAI-native-Systems-Research\u002Fai-native-storage-certus\u002Fblob\u002Funstable\u002Fcomponents\u002Fzyre\u002F.claude\u002Fskills\u002Ftools-creusot-install\u002FSKILL.md",[],[105,106,20,30,97,107],"tools creusot install","install","tool",{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":37},"01M6KP22H28FQ1X0V7VJHEFWXD","tools-creusot-init","Prepare an existing Cargo project to use Creusot formal verification","https:\u002F\u002Fgithub.com\u002FAI-native-Systems-Research\u002Fai-native-storage-certus\u002Fblob\u002Funstable\u002Fcomponents\u002Fzyre\u002F.claude\u002Fskills\u002Ftools-creusot-init\u002FSKILL.md",[],[115,20,116,117,118,119,120,97,121,91,122,123,124],"tools creusot init","init","project","directory","components","prepare","use","cargo","manager","Existing",{"skillNo":126,"name":127,"nameZh":6,"description":128,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":129,"categories":130,"keywords":131,"publishedAt":37},"01M6KP1V506J9YM8DKKVDG1NRE","tools-creusot-coq-install","Add Coq 8.20 as an additional prover to an existing Creusot installation, for verification conditions that SMT solvers cannot discharge","https:\u002F\u002Fgithub.com\u002FAI-native-Systems-Research\u002Fai-native-storage-certus\u002Fblob\u002Funstable\u002Fcomponents\u002Fzyre\u002F.claude\u002Fskills\u002Ftools-creusot-coq-install\u002FSKILL.md",[],[132,133,106,20,93,124,134,135,97,136],"tools creusot coq install","Coq","as","installation","add",{"skillNo":138,"name":139,"nameZh":6,"description":140,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":141,"categories":142,"keywords":143,"publishedAt":37},"01M6KP1PQJF3H765TYZAZ7P3EF","tools-creusot-annotate-interfaces","Formally verify a component's properties with Creusot and annotate its interface definitions","https:\u002F\u002Fgithub.com\u002FAI-native-Systems-Research\u002Fai-native-storage-certus\u002Fblob\u002Funstable\u002Fcomponents\u002Fzyre\u002F.claude\u002Fskills\u002Ftools-creusot-annotate-interfaces\u002FSKILL.md",[],[20,144,145,78,77,146,21,147,148],"tools creusot annotate interfaces","annotate","properties","component","interface"]