fstarlang/proof-copilot/specreview

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Review F*/Pulse specifications for completeness, strength, and usability

Install

npx vskill@latest install fstarlang/proof-copilot/specreview

SKILL.md

Invocation

This skill is used when:

  • Reviewing the quality of F* or Pulse specifications
  • Checking that postconditions prove functional correctness, not just type safety
  • Auditing a module's interface (.fsti) for completeness
  • Verifying that specifications connect implementations to their mathematical models

Functional Correctness Checklist

For each function with a specification, verify:

1. Does the postcondition prove the RIGHT thing?

❌ Weak: ensures (result >= 0) — proves a type property, not correctness ✅ Strong: ensures (result == factorial n) — proves functional correctness

❌ Weak: ensures (is_valid_flow result) — proves a structural property ✅ Strong: ensures (flow_value result == max_flow graph) — proves optimality

2. Does the postcondition connect to the pure specification?

Every imperative implementation should have a postcondition referencing the corresponding pure spec function:

pulse
fn sort_impl (arr: array int) (n: SizeT.t)
(#s: erased (Seq.seq int))
requires A.pts_to arr s ** pure (SZ.v n == Seq.length s)
ensures exists* s'.
A.pts_to arr s' **
pure (
Seq.length s' == Seq.length s /\ // same length
sorted s' /\ // result is sorted
permutation s s' // result is a permutation of input
)

NOT just: ensures exists* s'. A.pts_to arr s' ** pure (sorted s') (This doesn't prove the output is related to the input!)

3. Is the specification exposed in the interface?

Check the .fsti file:

  • All postconditions referencing spec functions must be visible
  • If the .fsti hides the postcondition, callers cannot reason about the result
  • Internal helper predicates used in postconditions should be exported or

abstracted behind a meaningful interface predicate

fstar
// BAD .fsti: hides the correctness property
val dijkstra (g: graph) (src: vertex) : ST (array nat) ...
// No ensures clause visible!
// GOOD .fsti: exposes the spec connection
val dijkstra (g: graph) (src: vertex) : ST (array nat)
(requires ...)
(ensures fun dist -> forall v.
dist.[v] == shortest_path_weight g src v)
4. Can a caller USE the postcondition?

Verify that the postcondition is stated in terms a caller can work with:

  • Uses spec-level types, not implementation-internal predicates
  • Quantified properties have useful SMT patterns
  • Key lemmas connecting the postcondition to further reasoning are available
5. Are algorithm-specific properties proven?

For algorithm implementations, check against the algorithm's mathematical guarantees:

AlgorithmMust Prove
SortingOutput is sorted AND a permutation of input
Shortest pathDistances are actual shortest paths, not just "some path"
MSTResult is a spanning tree AND has minimum weight
SearchReturns correct index AND element equality
Union-FindOperations maintain equivalence relation correctly
Max-flowFlow value equals the max-flow (not just "a valid flow")

Common Weak-Spec Patterns

Pattern 1: Proving Type Safety Only
fstar
// WEAK: proves nothing about what the function computes
val lookup : table -> key -> option value
fstar
// STRONG: proves the lookup matches the logical model
val lookup : t:table -> k:key -> r:option value{r == Table.find (model t) k}
Pattern 2: Proving Partial Properties
fstar
// WEAK: only proves the output is a tree, not that it's the MST
ensures (is_spanning_tree result graph)
fstar
// STRONG: proves it's minimal among all spanning trees
ensures (is_spanning_tree result graph /\
forall t. is_spanning_tree t graph ==> weight result <= weight t)
Pattern 3: Postcondition References Impl Internals
fstar
// WEAK: uses implementation-internal predicate
ensures (imp_valid_state result)
// STRONG: connects to spec via a correspondence lemma
ensures (model result == Spec.expected_state input)
Pattern 4: Missing Permutation/Conservation Properties
fstar
// WEAK: sorting — doesn't prove output relates to input
ensures (sorted result)
// STRONG: proves it's a sorted permutation of the input
ensures (sorted result /\ permutation_of result input)

Interface Audit Checklist

When reviewing a .fsti file:

  1. [ ] Every exported function has explicit requires/ensures
  2. [ ] Postconditions reference spec-level definitions, not impl internals
  3. [ ] No abstract predicates that hide essential correctness properties
  4. [ ] Key lemmas that callers need are exported
  5. [ ] Correspondence predicates (relating impl state to spec state) are available
  6. [ ] Types that callers need to reason about are not unnecessarily abstract

Spec Module Completeness

For the pure spec module:

  1. [ ] All algorithm operations have pure spec functions
  2. [ ] Spec functions match the algorithm's definition (CLRS, paper, etc.)
  3. [ ] Key properties of the spec are stated as lemmas
  4. [ ] Spec is independent of implementation concerns (no machine integers, no effects)

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/fstarlang/proof-copilot/specreview/badge)](https://verified-skill.com/skills/fstarlang/proof-copilot/specreview)

Something wrong with this skill or its page? Tell us.