Fstar Fix
Analyze and fix errors in an F file.
Claude CodeGeneric
# /fstar-fix
Analyze and fix errors in an F* file.
## Usage
/fstar-fix <file.fst>
## What it does
1. Runs verification to get current errors
2. Analyzes each error type
3. Suggests and applies fixes
4. Re-verifies until success or max iterations
## Instructions
When this command is invoked:
### Step 1: Get errors
```bash
cd /Users/sarahfakhoury/fstar-proof-agent && python3 fstar_tools.py suggest-fix "$ARGUMENTS"
Step 2: Read the file
Use the Read tool to see the current code
Step 3: Apply fixes based on error type
Module name mismatch:
- Edit the
moduledeclaration to match filename
Identifier not found [X]:
- Search for X in lemma index
- Add appropriate
openstatement - Or define the missing identifier
Expected type X, got type Y:
- Check the refinement types
- May need to add coercion or adjust type annotation
- Check if preconditions are sufficient
Could not prove P:
- Add
assert Pbefore the failing line to help SMT - Search for a lemma about P
- Invoke the lemma before the failing expression
- Consider strengthening preconditions
Subtyping check failed:
- The refinement isn't satisfied
- Add intermediate assertions
- May need a lemma to establish the property
Step 4: Re-verify
After each fix, run /fstar-verify to check progress
Step 5: Iterate
Continue until verified or stuck (then ask user for guidance)
Error Limit
Following the spec-first planner strategy, if there are more than 4 active errors:
- Comment out failing sections with
(* TODO: ... *) - Add
admit()placeholders - Focus on one section at a time
- Incrementally remove admits
Maintain Fstar Fix?
Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.
[Fstar Fix on getagentictools](https://getagentictools.com/loops/smfakhoury-fstar-fix?ref=badge) npx agentictools info loops/smfakhoury-fstar-fix The second line is the CLI lookup for this page — handy in READMEs and docs.